summaryrefslogtreecommitdiffstats
path: root/test/test_ncurses_unicode.cc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 17:44:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 17:44:55 +0000
commit5068d34c08f951a7ea6257d305a1627b09a95817 (patch)
tree08213e2be853396a3b07ce15dbe222644dcd9a89 /test/test_ncurses_unicode.cc
parentInitial commit. (diff)
downloadlnav-5068d34c08f951a7ea6257d305a1627b09a95817.tar.xz
lnav-5068d34c08f951a7ea6257d305a1627b09a95817.zip
Adding upstream version 0.11.1.upstream/0.11.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/test_ncurses_unicode.cc')
-rw-r--r--test/test_ncurses_unicode.cc40
1 files changed, 40 insertions, 0 deletions
diff --git a/test/test_ncurses_unicode.cc b/test/test_ncurses_unicode.cc
new file mode 100644
index 0000000..47f8ef2
--- /dev/null
+++ b/test/test_ncurses_unicode.cc
@@ -0,0 +1,40 @@
+
+#include <stdlib.h>
+
+#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[])
+{
+ setenv("LANG", "en_US.utf-8", 1);
+ setlocale(LC_ALL, "");
+
+ WINDOW* stdscr = initscr();
+ cbreak();
+ char buf[1024];
+ FILE* file = fopen(argv[1], "r");
+ int row = 0;
+ while (!feof(file)) {
+ if (fgets(buf, sizeof(buf), file) != nullptr) {
+ mvwaddstr(stdscr, row++, 0, buf);
+ }
+ }
+ getch();
+ endwin();
+}