rs

FTDI serial communication program
git clone git://git.2f30.org/rs
Log | Files | Refs | README | LICENSE

commit 45e97c4342b3cda9bd2a3424ebe7218404546daf
parent 8ddd819574c2d982571e2c32555a9d9954dd2565
Author: sin <sin@2f30.org>
Date:   Sat, 16 Nov 2013 14:14:07 +0000

Query for _PC_VDISABLE and fallback to zero if needed

Diffstat:
Mrs.c | 12+++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/rs.c b/rs.c @@ -29,6 +29,16 @@ interrupt(int sig) static int ttyinit(void) { + long vdisable; + + errno = 0; + vdisable = fpathconf(STDIN_FILENO, _PC_VDISABLE); + if (vdisable < 0) { + if (errno) + eprintf("fpathconf: _PC_VDISABLE:"); + vdisable = 0; + } + tcgetattr(STDIN_FILENO, &tio); savedtio = tio; cfmakeraw(&tio); @@ -36,7 +46,7 @@ ttyinit(void) tio.c_cc[VTIME] = 0; tio.c_lflag |= ISIG; tio.c_cc[VQUIT] = CTRL('\\'); - tio.c_cc[VINTR] = 0; + tio.c_cc[VINTR] = vdisable; tcsetattr(STDIN_FILENO, TCSAFLUSH, &tio); return 0; }