feat: Exit with ctrl-q.
This commit is contained in:
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user