Don't steal Ctrl-C from the kernel by default (so leave SIGINT enabled); add a flag to take it if required

This commit is contained in:
Paul LeoNerd Evans
2011-03-23 23:20:24 +00:00
parent a71f68dd57
commit 9f0ef4953d
3 changed files with 10 additions and 1 deletions

View File

@@ -278,7 +278,12 @@ static TermKey *termkey_new_full(int fd, int flags, size_t buffsize, int waittim
tk->restore_termios_valid = 1;
termios.c_iflag &= ~(IXON|INLCR|ICRNL);
termios.c_lflag &= ~(ICANON|ECHO|ISIG);
termios.c_lflag &= ~(ICANON|ECHO);
termios.c_cc[VQUIT] = 0;
termios.c_cc[VSUSP] = 0;
if(flags & TERMKEY_FLAG_CTRLC)
termios.c_cc[VINTR] = 0;
tcsetattr(fd, TCSANOW, &termios);
}