From 522bb454796ccd97fd99730814b7f04a35a0954e Mon Sep 17 00:00:00 2001 From: Gerhard Rieger Date: Sun, 11 Jan 2015 15:29:07 +0100 Subject: [PATCH] Added option rawer for pty --- CHANGES | 3 +++ test.sh | 4 +++- xio-termios.c | 4 +++- xio-termios.h | 4 +++- xioopts.c | 10 ++++++++++ xioopts.h | 2 ++ 6 files changed, 24 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index 9dcde43..853d9f4 100644 --- a/CHANGES +++ b/CHANGES @@ -47,6 +47,9 @@ new features: Added support for methods TLSv1, TLSv1.1, TLSv1.2, and DTLS1 Tests: OPENSSL_METHOD_* + Added a new option termios-rawer for ptys. + Thanks to Christian Vogelgsang for pointing me to this requirement + corrections: Bind with ABSTRACT commands used non-abstract namespace (Linux). Test: ABSTRACT_BIND diff --git a/test.sh b/test.sh index 8274c81..01d1876 100755 --- a/test.sh +++ b/test.sh @@ -178,7 +178,9 @@ case "$UNAME" in # ;; *) PTYOPTS="echo=0,opost=0" - PTYOPTS2="raw,echo=0" + #PTYOPTS2="raw,echo=0" + #PTYOPTS2="cfmakeraw" + PTYOPTS2="rawer" ;; esac diff --git a/xio-termios.c b/xio-termios.c index 8d8d331..ce3346c 100644 --- a/xio-termios.c +++ b/xio-termios.c @@ -1,5 +1,5 @@ /* source: xio-termios.c */ -/* Copyright Gerhard Rieger 2001-2011 */ +/* Copyright Gerhard Rieger */ /* Published under the GNU General Public License V.2, see file COPYING */ /* this file contains the source for terminal I/O options */ @@ -268,6 +268,8 @@ const struct optdesc opt_veol2 = { "veol2", "eol2", OPT_VEOL2, GROUP_TER const struct optdesc opt_raw = { "raw", NULL, OPT_RAW, GROUP_TERMIOS, PH_FD, TYPE_CONST, OFUNC_TERMIOS_SPEC }; const struct optdesc opt_sane = { "sane", NULL, OPT_SANE, GROUP_TERMIOS, PH_FD, TYPE_CONST, OFUNC_TERMIOS_SPEC }; +const struct optdesc opt_termios_cfmakeraw = { "termios-cfmakeraw", "cfmakeraw", OPT_TERMIOS_CFMAKERAW, GROUP_TERMIOS, PH_FD, TYPE_CONST, OFUNC_TERMIOS_SPEC }; +const struct optdesc opt_termios_rawer = { "termios-rawer", "rawer", OPT_TERMIOS_RAWER, GROUP_TERMIOS, PH_FD, TYPE_CONST, OFUNC_TERMIOS_SPEC }; #ifdef HAVE_TERMIOS_ISPEED #if defined(ISPEED_OFFSET) && (ISPEED_OFFSET != -1) diff --git a/xio-termios.h b/xio-termios.h index 7944c67..7fd3550 100644 --- a/xio-termios.h +++ b/xio-termios.h @@ -1,5 +1,5 @@ /* source: xio-termios.h */ -/* Copyright Gerhard Rieger 2001-2008 */ +/* Copyright Gerhard Rieger */ /* Published under the GNU General Public License V.2, see file COPYING */ #ifndef __xio_termios_h_included @@ -138,6 +138,8 @@ extern const struct optdesc opt_sane; extern const struct optdesc opt_ispeed; extern const struct optdesc opt_ospeed; +extern const struct optdesc opt_termios_rawer; + #if _WITH_TERMIOS /* otherwise tcflag_t might be reported undefined */ extern int xiotermios_setflag(int fd, int word, tcflag_t mask); extern int xiotermios_clrflag(int fd, int word, tcflag_t mask); diff --git a/xioopts.c b/xioopts.c index 13118e7..94015f1 100644 --- a/xioopts.c +++ b/xioopts.c @@ -1196,6 +1196,7 @@ const struct optname optionnames[] = { IF_TERMIOS("quit", &opt_vquit) IF_RANGE ("range", &opt_range) IF_TERMIOS("raw", &opt_raw) + IF_TERMIOS("rawer", &opt_termios_rawer) IF_SOCKET ("rcvbuf", &opt_so_rcvbuf) IF_SOCKET ("rcvbuf-late", &opt_so_rcvbuf_late) #ifdef SO_RCVLOWAT @@ -1623,6 +1624,8 @@ const struct optname optionnames[] = { IF_IPAPP ("tcpwrapper", &opt_tcpwrappers) IF_IPAPP ("tcpwrappers", &opt_tcpwrappers) #endif + IF_TERMIOS("termios-cfmakeraw", &opt_termios_cfmakeraw) + IF_TERMIOS("termios-rawer", &opt_termios_rawer) #ifdef O_TEXT IF_ANY ("text", &opt_o_text) #endif @@ -3647,6 +3650,13 @@ int applyopts(int fd, struct opt *opts, enum e_phase phase) { termarg.c_cc[VMIN] = 1; termarg.c_cc[VTIME] = 0; break; + case OPT_TERMIOS_RAWER: + termarg.c_iflag = 0; + termarg.c_oflag = 0; + termarg.c_lflag = 0; + termarg.c_cc[VMIN] = 1; + termarg.c_cc[VTIME] = 0; + break; case OPT_SANE: /* cread -ignbrk brkint -inlcr -igncr icrnl -ixoff -iuclc -ixany imaxbel opost -olcuc -ocrnl diff --git a/xioopts.h b/xioopts.h index f4853cd..ebcf315 100644 --- a/xioopts.h +++ b/xioopts.h @@ -785,6 +785,8 @@ enum e_optcode { #ifdef TCP_WINDOW_CLAMP OPT_TCP_WINDOW_CLAMP, /* Linux 2.4.0 */ #endif + OPT_TERMIOS_CFMAKERAW, /* termios.cfmakeraw() */ + OPT_TERMIOS_RAWER, OPT_TIOCSCTTY, OPT_TOSTOP, /* termios.c_lflag */ OPT_TUN_DEVICE, /* tun: /dev/net/tun ... */