2017-08-01 17:17:30 +00:00
|
|
|
|
2020-11-10 06:18:17 +00:00
|
|
|
#include <stdlib.h>
|
2022-03-16 22:38:08 +00:00
|
|
|
|
2017-08-01 17:17:30 +00:00
|
|
|
#include "config.h"
|
|
|
|
#define _XOPEN_SOURCE_EXTENDED 1
|
|
|
|
#include <locale.h>
|
|
|
|
|
|
|
|
#if defined HAVE_NCURSESW_CURSES_H
|
2022-03-16 22:38:08 +00:00
|
|
|
# include <ncursesw/curses.h>
|
2017-08-01 17:17:30 +00:00
|
|
|
#elif defined HAVE_NCURSESW_H
|
2022-03-16 22:38:08 +00:00
|
|
|
# include <ncursesw.h>
|
2017-08-01 17:17:30 +00:00
|
|
|
#elif defined HAVE_NCURSES_CURSES_H
|
2022-03-16 22:38:08 +00:00
|
|
|
# include <ncurses/curses.h>
|
2017-08-01 17:17:30 +00:00
|
|
|
#elif defined HAVE_NCURSES_H
|
2022-03-16 22:38:08 +00:00
|
|
|
# include <ncurses.h>
|
2017-08-01 17:17:30 +00:00
|
|
|
#elif defined HAVE_CURSES_H
|
2022-03-16 22:38:08 +00:00
|
|
|
# include <curses.h>
|
2017-08-01 17:17:30 +00:00
|
|
|
#else
|
2022-03-16 22:38:08 +00:00
|
|
|
# error "SysV or X/Open-compatible Curses header file required"
|
2017-08-01 17:17:30 +00:00
|
|
|
#endif
|
|
|
|
|
2022-03-16 22:38:08 +00:00
|
|
|
int
|
|
|
|
main(int argc, char* argv[])
|
2017-08-01 17:17:30 +00:00
|
|
|
{
|
2020-11-10 06:18:17 +00:00
|
|
|
setenv("LANG", "en_US.utf-8", 1);
|
2017-08-01 17:17:30 +00:00
|
|
|
setlocale(LC_ALL, "");
|
|
|
|
|
2022-03-16 22:38:08 +00:00
|
|
|
WINDOW* stdscr = initscr();
|
2017-08-01 17:17:30 +00:00
|
|
|
cbreak();
|
|
|
|
char buf[1024];
|
2022-03-16 22:38:08 +00:00
|
|
|
FILE* file = fopen(argv[1], "r");
|
2017-08-01 17:17:30 +00:00
|
|
|
int row = 0;
|
|
|
|
while (!feof(file)) {
|
2018-03-29 20:45:59 +00:00
|
|
|
if (fgets(buf, sizeof(buf), file) != nullptr) {
|
2018-03-28 02:07:13 +00:00
|
|
|
mvwaddstr(stdscr, row++, 0, buf);
|
|
|
|
}
|
2017-08-01 17:17:30 +00:00
|
|
|
}
|
|
|
|
getch();
|
|
|
|
endwin();
|
|
|
|
}
|