aboutsummaryrefslogtreecommitdiff
path: root/loginutils
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2017-01-11 16:17:59 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2017-01-11 16:17:59 +0100
commit01ccdd1d3c5221789f1ac62ced12b7984d910705 (patch)
treea6eb44f24c1324ddf18bfcec57fd4c3735aa1245 /loginutils
parent8944c67b1f61ca6a51a485772d5d1e6a8ff3d83d (diff)
downloadbusybox-01ccdd1d3c5221789f1ac62ced12b7984d910705.tar.gz
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.c2
-rw-r--r--loginutils/vlock.c8
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)
/* non-raw output; add CR to each NL */
G.tty_attrs.c_oflag = OPOST | ONLCR;
- /* reads would block only if < 1 char is available */
+ /* reads will block only if < 1 char is available */
G.tty_attrs.c_cc[VMIN] = 1;
/* no timeout (reads block forever) */
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)
ioctl(STDIN_FILENO, VT_SETMODE, &vtm);
#endif
+//TODO: use set_termios_to_raw()
tcgetattr(STDIN_FILENO, &oterm);
term = oterm;
- term.c_iflag &= ~BRKINT;
- term.c_iflag |= IGNBRK;
- term.c_lflag &= ~ISIG;
- term.c_lflag &= ~(ECHO | ECHOCTL);
+ term.c_iflag |= IGNBRK; /* ignore serial break (why? VTs don't have breaks, right?) */
+ term.c_iflag &= ~BRKINT; /* redundant? "dont translate break to SIGINT" */
+ term.c_lflag &= ~(ISIG | ECHO | ECHOCTL); /* ignore ^C ^Z, echo off */
tcsetattr_stdin_TCSANOW(&term);
while (1) {