svn commit: r198185 - head/sys/kern

Ed Schouten ed at FreeBSD.org
Sat Oct 17 08:59:42 UTC 2009


Author: ed
Date: Sat Oct 17 08:59:41 2009
New Revision: 198185
URL: http://svn.freebsd.org/changeset/base/198185

Log:
  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

Modified:
  head/sys/kern/tty_ttydisc.c

Modified: head/sys/kern/tty_ttydisc.c
==============================================================================
--- head/sys/kern/tty_ttydisc.c	Sat Oct 17 08:58:01 2009	(r198184)
+++ head/sys/kern/tty_ttydisc.c	Sat Oct 17 08:59:41 2009	(r198185)
@@ -624,15 +624,21 @@ ttydisc_echo_force(struct tty *tp, char 
 		/*
 		 * 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++;


More information about the svn-src-head mailing list