Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 17 Oct 2009 08:59:41 +0000 (UTC)
From:      Ed Schouten <ed@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r198185 - head/sys/kern
Message-ID:  <200910170859.n9H8xf7X028023@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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++;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200910170859.n9H8xf7X028023>