This repository has been archived on 2021-02-07. You can view files and clone it, but cannot push or open issues or pull requests.
xterm-2021-02-07/test.c

26 lines
616 B
C
Raw Permalink Normal View History

2021-02-07 14:12:09 +00:00
#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;
}