feat: Exit with ctrl-q.
This commit is contained in:
@@ -7,6 +7,10 @@
|
||||
#include <termios.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/*** defines ***/
|
||||
|
||||
#define CTRL_KEY(k) ((k) & 0x1f)
|
||||
|
||||
/*** data ***/
|
||||
|
||||
struct termios orig_termios;
|
||||
@@ -57,7 +61,7 @@ int main() {
|
||||
} else {
|
||||
printf("%d ('%c')\r\n", c, c);
|
||||
}
|
||||
if (c == 'q')
|
||||
if (c == CTRL_KEY('q'))
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user