From cf76b5ce12a685b0c0a8ea53fa95cb0f0922a4f1 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Thu, 2 Oct 2014 13:45:21 +0200 Subject: [PATCH] getty: set tty attrs so that control chars are shown as ^c Signed-off-by: Denys Vlasenko --- loginutils/getty.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/loginutils/getty.c b/loginutils/getty.c index 4b1b73bef..174542841 100644 --- a/loginutils/getty.c +++ b/loginutils/getty.c @@ -334,18 +334,19 @@ static void finalize_tty_attrs(void) * observed to improve backspacing through Unicode chars */ - /* line buffered input (NL or EOL or EOF chars end a line); - * recognize INT/QUIT/SUSP chars; - * echo input chars; - * echo BS-SP-BS on erase character; - * echo kill char specially, not as ^c (ECHOKE controls how exactly); - * erase all input via BS-SP-BS on kill char (else go to next line) + /* ICANON line buffered input (NL or EOL or EOF chars end a line); + * ISIG recognize INT/QUIT/SUSP chars; + * ECHO echo input chars; + * ECHOE echo BS-SP-BS on erase character; + * ECHOK echo kill char specially, not as ^c (ECHOKE controls how exactly); + * ECHOKE erase all input via BS-SP-BS on kill char (else go to next line) + * ECHOCTL Echo ctrl chars as ^c (else echo verbatim: + * e.g. up arrow emits "ESC-something" and thus moves cursor up!) */ - G.tty_attrs.c_lflag |= ICANON | ISIG | ECHO | ECHOE | ECHOK | ECHOKE; + G.tty_attrs.c_lflag |= ICANON | ISIG | ECHO | ECHOE | ECHOK | ECHOKE | ECHOCTL; /* Other bits in c_lflag: * XCASE Map uppercase to \lowercase [tried, doesn't work] * ECHONL Echo NL even if ECHO is not set - * ECHOCTL Echo ctrl chars as ^c (else don't echo) - maybe set this? * ECHOPRT On erase, echo erased chars * [qwe input looks like "qwe\ewq/" on screen] * NOFLSH Don't flush input buffer after interrupt or quit chars