CharIoStdin: disable SIGINT generation with Ctrl-C.

This commit is contained in:
Maxim Poliakovski 2022-05-07 23:42:33 +02:00
parent e0b94e0b47
commit b26baaaeff

View File

@ -80,20 +80,17 @@ int CharIoStdin::rcv_enable()
new_termios.c_cflag &= ~(CSIZE | PARENB); new_termios.c_cflag &= ~(CSIZE | PARENB);
new_termios.c_cflag |= CS8; new_termios.c_cflag |= CS8;
new_termios.c_lflag &= ~(ECHO | ICANON); new_termios.c_lflag &= ~(ECHO | ICANON | ISIG);
new_termios.c_iflag &= ~(ICRNL); new_termios.c_iflag &= ~(ICRNL);
tcsetattr(STDIN_FILENO, TCSANOW, &new_termios); tcsetattr(STDIN_FILENO, TCSANOW, &new_termios);
// save original signal handler for SIGINT // save original signal handler for SIGINT
//struct sigaction new_act; // then redirect SIGINT to new handler
memset(&new_act, 0, sizeof(new_act)); memset(&new_act, 0, sizeof(new_act));
new_act.sa_handler = mysig_handler; new_act.sa_handler = mysig_handler;
sigaction(SIGINT, &new_act, &old_act); sigaction(SIGINT, &new_act, &old_act);
// redirect SIGINT to new handler
//signal(SIGINT, mysig_handler);
this->stdio_inited = true; this->stdio_inited = true;
return 0; return 0;