You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
616 B

#include <stdio.h>
#include <termios.h>
#include <unistd.h>
int main()
{
struct termios old_termios, new_termios;
int ch, fd_in = STDIN_FILENO;
tcgetattr(fd_in, &old_termios);
new_termios = old_termios;
new_termios.c_lflag &= ~(ICANON | ECHO);
tcsetattr(fd_in, TCSANOW, &new_termios);
setvbuf(stdout, NULL, _IONBF, 0);
printf("\033[?1002h");
printf("\033[?1016h");
while (EOF != (ch = getchar())) {
if (ch == 0x04) {
break;
}
}
printf("\033[?1016l");
printf("\033[?1002l");
tcsetattr(fd_in, TCSANOW, &old_termios);
return 0;
}