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
This commit is contained in:
Ed Schouten 2009-10-17 08:59:41 +00:00
parent 018a4f5fcf
commit 39410373b3

View File

@ -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++;