feat: Exit with ctrl-q.

This commit is contained in:
jmug
2026-10-09 17:36:48 -07:00
parent 908eb1ef1c
commit 0a682b779e
+5 -1
View File
@@ -7,6 +7,10 @@
#include <termios.h> #include <termios.h>
#include <unistd.h> #include <unistd.h>
/*** defines ***/
#define CTRL_KEY(k) ((k) & 0x1f)
/*** data ***/ /*** data ***/
struct termios orig_termios; struct termios orig_termios;
@@ -57,7 +61,7 @@ int main() {
} else { } else {
printf("%d ('%c')\r\n", c, c); printf("%d ('%c')\r\n", c, c);
} }
if (c == 'q') if (c == CTRL_KEY('q'))
break; break;
} }
return 0; return 0;