diff options
author | Thomas Voss <mail@thomasvoss.com> | 2024-10-28 02:18:06 +0100 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2024-10-28 02:18:06 +0100 |
commit | 083b0b53e450f317ca6e99cc1d077b10a5ac7d4d (patch) | |
tree | e6d9a96901caa2abbb37644fff4311d8d1c0f572 /src/blog/termios/test.c | |
parent | 8f2f9f53b88c451d8b8cb3aa7ee4302ef4c9278d (diff) |
Add a new article on termios
Diffstat (limited to 'src/blog/termios/test.c')
-rw-r--r-- | src/blog/termios/test.c | 21 |
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 */ +} |