summaryrefslogtreecommitdiffhomepage
path: root/src/blog/termios/test.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/blog/termios/test.c')
-rw-r--r--src/blog/termios/test.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/blog/termios/test.c b/src/blog/termios/test.c
new file mode 100644
index 0000000..dcb93d1
--- /dev/null
+++ b/src/blog/termios/test.c
@@ -0,0 +1,21 @@
+#include <curses.h>
+#include <stdio.h>
+#include <vis.h>
+
+int
+main(void)
+{
+ initscr(); /* Init screen */
+ noecho(); /* Don’t echo keypresses */
+
+ for (;;) {
+ /* Read char and encode it as a string */
+ char buf[5];
+ vis(buf, getch(), VIS_WHITE, 0);
+
+ clear(); /* Clear screen */
+ printw("%s\n", buf); /* Write char to screen */
+ refresh(); /* Refresh display */
+ }
+ /* unreachable */
+}