diff options
author | ed <ed@FreeBSD.org> | 2009-10-17 08:59:41 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2009-10-17 08:59:41 +0000 |
commit | 04a930203d8756192a9b04505239252be040b1dd (patch) | |
tree | 491ccb005442e2b05d3cfca87b297c2b04f317b3 /sys/kern/tty_ttydisc.c | |
parent | 1c42761b9b379fdccf329164ff298ee19b311850 (diff) | |
download | FreeBSD-src-04a930203d8756192a9b04505239252be040b1dd.zip FreeBSD-src-04a930203d8756192a9b04505239252be040b1dd.tar.gz |
Print backspaces after echoing an EOF.
Applications like shells expect EOF to give no graphical output, while
our implementation prints ^D by default (tunable with stty echoctl).
Make the new implementation behave like the old TTY code. Print two
backspaces afterwards.
Reported by: koitsu
MFC after: 1 month
Diffstat (limited to 'sys/kern/tty_ttydisc.c')
-rw-r--r-- | sys/kern/tty_ttydisc.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/sys/kern/tty_ttydisc.c b/sys/kern/tty_ttydisc.c index d79a2b7..6afac8d 100644 --- a/sys/kern/tty_ttydisc.c +++ b/sys/kern/tty_ttydisc.c @@ -624,15 +624,21 @@ ttydisc_echo_force(struct tty *tp, char c, int quote) /* * Only use ^X notation when ECHOCTL is turned on and * we've got an quoted control character. + * + * Print backspaces when echoing an end-of-file. */ - char ob[2] = { '^', '?' }; + char ob[4] = "^?\b\b"; /* Print ^X notation. */ if (c != 0x7f) ob[1] = c + 'A' - 1; - tp->t_column += 2; - return ttyoutq_write_nofrag(&tp->t_outq, ob, 2); + if (!quote && CMP_CC(VEOF, c)) { + return ttyoutq_write_nofrag(&tp->t_outq, ob, 4); + } else { + tp->t_column += 2; + return ttyoutq_write_nofrag(&tp->t_outq, ob, 2); + } } else { /* Can just be printed. */ tp->t_column++; |