diff options
Diffstat (limited to 'miscutils')
-rw-r--r-- | miscutils/less.c | 12 | ||||
-rw-r--r-- | miscutils/microcom.c | 14 |
2 files changed, 8 insertions, 18 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); diff --git a/miscutils/microcom.c b/miscutils/microcom.c index b87f327..fa09005 100644 --- a/miscutils/microcom.c +++ b/miscutils/microcom.c @@ -33,15 +33,11 @@ // set raw tty mode static void xget1(int fd, struct termios *t, struct termios *oldt) { -//TODO: use set_termios_to_raw() - tcgetattr(fd, oldt); - *t = *oldt; - cfmakeraw(t); -// t->c_lflag &= ~(ISIG|ICANON|ECHO|IEXTEN); -// t->c_iflag &= ~(BRKINT|IXON|ICRNL); -// t->c_oflag &= ~(ONLCR); -// t->c_cc[VMIN] = 1; -// t->c_cc[VTIME] = 0; + get_termios_and_make_raw(fd, t, oldt, 0 + | TERMIOS_CLEAR_ISIG /* ^C is ASCII char 3, not "interrupt me!" */ + | TERMIOS_RAW_INPUT /* pass all chars verbatim, no special handling or translating CR->NL */ + | TERMIOS_RAW_CRNL /* dont convert NL<->CR on output too */ + ); } static int xset1(int fd, struct termios *tio, const char *device) |