diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2017-01-11 16:17:59 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2017-01-11 16:17:59 +0100 |
commit | 01ccdd1d3c5221789f1ac62ced12b7984d910705 (patch) | |
tree | a6eb44f24c1324ddf18bfcec57fd4c3735aa1245 /loginutils | |
parent | 8944c67b1f61ca6a51a485772d5d1e6a8ff3d83d (diff) | |
download | busybox-w32-01ccdd1d3c5221789f1ac62ced12b7984d910705.tar.gz busybox-w32-01ccdd1d3c5221789f1ac62ced12b7984d910705.tar.bz2 busybox-w32-01ccdd1d3c5221789f1ac62ced12b7984d910705.zip |
libbb: consolidate the code to set termios unbuffered mode
function old new delta
set_termios_to_raw - 116 +116
count_lines 72 74 +2
powertop_main 1458 1430 -28
top_main 943 914 -29
more_main 759 714 -45
fsck_minix_main 2969 2921 -48
conspy_main 1197 1135 -62
rawmode 99 36 -63
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/6 up/down: 118/-275) Total: -157 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'loginutils')
-rw-r--r-- | loginutils/getty.c | 2 | ||||
-rw-r--r-- | loginutils/vlock.c | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/loginutils/getty.c b/loginutils/getty.c index 162c1697e..ba6c784a3 100644 --- a/loginutils/getty.c +++ b/loginutils/getty.c | |||
@@ -316,7 +316,7 @@ static void init_tty_attrs(int speed) | |||
316 | /* non-raw output; add CR to each NL */ | 316 | /* non-raw output; add CR to each NL */ |
317 | G.tty_attrs.c_oflag = OPOST | ONLCR; | 317 | G.tty_attrs.c_oflag = OPOST | ONLCR; |
318 | 318 | ||
319 | /* reads would block only if < 1 char is available */ | 319 | /* reads will block only if < 1 char is available */ |
320 | G.tty_attrs.c_cc[VMIN] = 1; | 320 | G.tty_attrs.c_cc[VMIN] = 1; |
321 | /* no timeout (reads block forever) */ | 321 | /* no timeout (reads block forever) */ |
322 | G.tty_attrs.c_cc[VTIME] = 0; | 322 | G.tty_attrs.c_cc[VTIME] = 0; |
diff --git a/loginutils/vlock.c b/loginutils/vlock.c index 52ae607c9..5ba6a8780 100644 --- a/loginutils/vlock.c +++ b/loginutils/vlock.c | |||
@@ -105,12 +105,12 @@ int vlock_main(int argc UNUSED_PARAM, char **argv) | |||
105 | ioctl(STDIN_FILENO, VT_SETMODE, &vtm); | 105 | ioctl(STDIN_FILENO, VT_SETMODE, &vtm); |
106 | #endif | 106 | #endif |
107 | 107 | ||
108 | //TODO: use set_termios_to_raw() | ||
108 | tcgetattr(STDIN_FILENO, &oterm); | 109 | tcgetattr(STDIN_FILENO, &oterm); |
109 | term = oterm; | 110 | term = oterm; |
110 | term.c_iflag &= ~BRKINT; | 111 | term.c_iflag |= IGNBRK; /* ignore serial break (why? VTs don't have breaks, right?) */ |
111 | term.c_iflag |= IGNBRK; | 112 | term.c_iflag &= ~BRKINT; /* redundant? "dont translate break to SIGINT" */ |
112 | term.c_lflag &= ~ISIG; | 113 | term.c_lflag &= ~(ISIG | ECHO | ECHOCTL); /* ignore ^C ^Z, echo off */ |
113 | term.c_lflag &= ~(ECHO | ECHOCTL); | ||
114 | tcsetattr_stdin_TCSANOW(&term); | 114 | tcsetattr_stdin_TCSANOW(&term); |
115 | 115 | ||
116 | while (1) { | 116 | while (1) { |