aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2018-04-16 10:24:48 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2018-04-16 10:24:48 +0200
commit058a153b6970660f3c284ac259986ae87507df9a (patch)
treea43cce5c5cdfd826aa15955bb53b8dbcceec0a6b /libbb
parentc72499584abbf32b3757024bb0cd53f23d5d0d72 (diff)
downloadbusybox-w32-058a153b6970660f3c284ac259986ae87507df9a.tar.gz
busybox-w32-058a153b6970660f3c284ac259986ae87507df9a.tar.bz2
busybox-w32-058a153b6970660f3c284ac259986ae87507df9a.zip
less: fix fallout from "use common routine to set raw termios"
Testcase: (sleep 10; ls) | busybox less [...] ~ LICENSE ~ Makefile ~ Makefile.custom ~ Makefile.flags [...] less did not want this part: + /* dont convert NL to CR+NL on output */ + newterm->c_oflag &= ~(ONLCR); function old new delta get_termios_and_make_raw 108 115 +7 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
-rw-r--r--libbb/xfuncs.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c
index e8c027f17..b4d512bd6 100644
--- a/libbb/xfuncs.c
+++ b/libbb/xfuncs.c
@@ -330,7 +330,6 @@ int FAST_FUNC get_termios_and_make_raw(int fd, struct termios *newterm, struct t
330 newterm->c_cc[VMIN] = 1; 330 newterm->c_cc[VMIN] = 1;
331 /* no timeout (reads block forever) */ 331 /* no timeout (reads block forever) */
332 newterm->c_cc[VTIME] = 0; 332 newterm->c_cc[VTIME] = 0;
333 if (flags & TERMIOS_RAW_CRNL) {
334/* IXON, IXOFF, and IXANY: 333/* IXON, IXOFF, and IXANY:
335 * IXOFF=1: sw flow control is enabled on input queue: 334 * IXOFF=1: sw flow control is enabled on input queue:
336 * tty transmits a STOP char when input queue is close to full 335 * tty transmits a STOP char when input queue is close to full
@@ -340,9 +339,12 @@ int FAST_FUNC get_termios_and_make_raw(int fd, struct termios *newterm, struct t
340 * and resume sending if START is received, or if any char 339 * and resume sending if START is received, or if any char
341 * is received and IXANY=1. 340 * is received and IXANY=1.
342 */ 341 */
342 if (flags & TERMIOS_RAW_CRNL_INPUT) {
343 /* IXON=0: XON/XOFF chars are treated as normal chars (why we do this?) */ 343 /* IXON=0: XON/XOFF chars are treated as normal chars (why we do this?) */
344 /* dont convert CR to NL on input */ 344 /* dont convert CR to NL on input */
345 newterm->c_iflag &= ~(IXON | ICRNL); 345 newterm->c_iflag &= ~(IXON | ICRNL);
346 }
347 if (flags & TERMIOS_RAW_CRNL_OUTPUT) {
346 /* dont convert NL to CR+NL on output */ 348 /* dont convert NL to CR+NL on output */
347 newterm->c_oflag &= ~(ONLCR); 349 newterm->c_oflag &= ~(ONLCR);
348 /* Maybe clear more c_oflag bits? Usually, only OPOST and ONLCR are set. 350 /* Maybe clear more c_oflag bits? Usually, only OPOST and ONLCR are set.
@@ -363,9 +365,12 @@ int FAST_FUNC get_termios_and_make_raw(int fd, struct termios *newterm, struct t
363#ifndef IXANY 365#ifndef IXANY
364# define IXANY 0 366# define IXANY 0
365#endif 367#endif
366 /* IXOFF=0: disable sending XON/XOFF if input buf is full */ 368 /* IXOFF=0: disable sending XON/XOFF if input buf is full
367 /* IXON=0: input XON/XOFF chars are not special */ 369 * IXON=0: input XON/XOFF chars are not special
368 /* dont convert anything on input */ 370 * BRKINT=0: dont send SIGINT on break
371 * IMAXBEL=0: dont echo BEL on input line too long
372 * INLCR,ICRNL,IUCLC: dont convert anything on input
373 */
369 newterm->c_iflag &= ~(IXOFF|IXON|IXANY|BRKINT|INLCR|ICRNL|IUCLC|IMAXBEL); 374 newterm->c_iflag &= ~(IXOFF|IXON|IXANY|BRKINT|INLCR|ICRNL|IUCLC|IMAXBEL);
370 } 375 }
371 return r; 376 return r;