[git commit] getty: set tty attrs so that control chars are shown as ^c

Denys Vlasenko vda.linux at googlemail.com
Thu Oct 2 11:45:21 UTC 2014


commit: http://git.busybox.net/busybox/commit/?id=cf76b5ce12a685b0c0a8ea53fa95cb0f0922a4f1
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 loginutils/getty.c |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/loginutils/getty.c b/loginutils/getty.c
index 4b1b73b..1745428 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<BS><BS><BS> input looks like "qwe\ewq/" on screen]
 	 * NOFLSH  Don't flush input buffer after interrupt or quit chars


More information about the busybox-cvs mailing list