diff options
author | Denys Vlasenko | 2017-09-15 17:14:01 +0200 |
---|---|---|
committer | Denys Vlasenko | 2017-09-15 17:14:01 +0200 |
commit | aaaaaa5ad6a93101d38800467fe3750b35fed6ea (patch) | |
tree | 8cd7b7561f3e923a382e5f97b4bd0fbe5fd68c39 /miscutils/less.c | |
parent | e58b44755dbac7c55bf602f7f76dfb37b47323f5 (diff) | |
download | busybox-aaaaaa5ad6a93101d38800467fe3750b35fed6ea.zip busybox-aaaaaa5ad6a93101d38800467fe3750b35fed6ea.tar.gz |
less,microcom,lineedit: use common routine to set raw termios
function old new delta
get_termios_and_make_raw - 139 +139
xget1 39 8 -31
read_line_input 3912 3867 -45
less_main 2525 2471 -54
set_termios_to_raw 116 36 -80
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/4 up/down: 139/-210) Total: -71 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'miscutils/less.c')
-rw-r--r-- | miscutils/less.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/miscutils/less.c b/miscutils/less.c index d524b6c..c6c158a 100644 --- a/miscutils/less.c +++ b/miscutils/less.c @@ -1824,15 +1824,9 @@ int less_main(int argc, char **argv) G.kbd_fd_orig_flags = ndelay_on(tty_fd); kbd_fd = tty_fd; /* save in a global */ - tcgetattr(kbd_fd, &term_orig); - term_less = term_orig; - term_less.c_lflag &= ~(ICANON | ECHO); - term_less.c_iflag &= ~(IXON | ICRNL); - /*term_less.c_oflag &= ~ONLCR;*/ - term_less.c_cc[VMIN] = 1; - term_less.c_cc[VTIME] = 0; - - IF_FEATURE_LESS_ASK_TERMINAL(G.winsize_err =) get_terminal_width_height(kbd_fd, &width, &max_displayed_line); + get_termios_and_make_raw(tty_fd, &term_less, &term_orig, TERMIOS_RAW_CRNL); + + IF_FEATURE_LESS_ASK_TERMINAL(G.winsize_err =) get_terminal_width_height(tty_fd, &width, &max_displayed_line); /* 20: two tabstops + 4 */ if (width < 20 || max_displayed_line < 3) return bb_cat(argv); |