26 lines
616 B
C
26 lines
616 B
C
#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;
|
|
}
|