mirror of
https://github.com/tstack/lnav.git
synced 2024-09-11 13:05:51 +03:00
Unused-result from sensitive APIs, printf/scanf formatting types, set but never used variables, and uninitialized variables. Also there's one select(enum) that doesn't cover all cases.
37 lines
792 B
C++
37 lines
792 B
C++
|
|
#include "config.h"
|
|
#define _XOPEN_SOURCE_EXTENDED 1
|
|
#include <locale.h>
|
|
|
|
#if defined HAVE_NCURSESW_CURSES_H
|
|
# include <ncursesw/curses.h>
|
|
#elif defined HAVE_NCURSESW_H
|
|
# include <ncursesw.h>
|
|
#elif defined HAVE_NCURSES_CURSES_H
|
|
# include <ncurses/curses.h>
|
|
#elif defined HAVE_NCURSES_H
|
|
# include <ncurses.h>
|
|
#elif defined HAVE_CURSES_H
|
|
# include <curses.h>
|
|
#else
|
|
# error "SysV or X/Open-compatible Curses header file required"
|
|
#endif
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
setlocale(LC_ALL, "");
|
|
|
|
WINDOW *stdscr = initscr();
|
|
cbreak();
|
|
char buf[1024];
|
|
FILE *file = fopen(argv[1], "r");
|
|
int row = 0;
|
|
while (!feof(file)) {
|
|
if (0 < fgets(buf, sizeof(buf), file)) {
|
|
mvwaddstr(stdscr, row++, 0, buf);
|
|
}
|
|
}
|
|
getch();
|
|
endwin();
|
|
}
|