aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul LeoNerd Evans <leonerd@leonerd.org.uk>2011-05-24 16:40:19 +0100
committerPaul LeoNerd Evans <leonerd@leonerd.org.uk>2011-05-24 16:40:19 +0100
commit6b17f3f620d99670e915ae97f21d24cd765b7b4d (patch)
tree4e3fd389af2f47e86fe2d95ea7dca6f89f338520
parent41e9e0d39ef00e651cf79e9be9832c099fbad5d8 (diff)
downloadtermo-6b17f3f620d99670e915ae97f21d24cd765b7b4d.tar.gz
termo-6b17f3f620d99670e915ae97f21d24cd765b7b4d.tar.xz
termo-6b17f3f620d99670e915ae97f21d24cd765b7b4d.zip
Disable ISIG mode entirely if FLAG_CTRLC is set
-rw-r--r--termkey.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/termkey.c b/termkey.c
index 48ec164..3966d5a 100644
--- a/termkey.c
+++ b/termkey.c
@@ -280,10 +280,14 @@ static TermKey *termkey_new_full(int fd, int flags, size_t buffsize, int waittim
termios.c_iflag &= ~(IXON|INLCR|ICRNL);
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;
+ /* want no signal keys at all, so just disable ISIG */
+ termios.c_lflag &= ~ISIG;
+ else {
+ /* Disable Ctrl-\==VQUIT and Ctrl-D==VSUSP but leave Ctrl-C as SIGINT */
+ termios.c_cc[VQUIT] = 0;
+ termios.c_cc[VSUSP] = 0;
+ }
tcsetattr(fd, TCSANOW, &termios);
}