svn commit: r272482 - in head/bin/sh: . tests/builtins

Jilles Tjoelker jilles at FreeBSD.org
Fri Oct 3 20:24:58 UTC 2014


Author: jilles
Date: Fri Oct  3 20:24:56 2014
New Revision: 272482
URL: https://svnweb.freebsd.org/changeset/base/272482

Log:
  sh: Fix LINENO and prompt after $'\0 and newline.

Added:
  head/bin/sh/tests/builtins/lineno3.0   (contents, props changed)
  head/bin/sh/tests/builtins/lineno3.0.stdout   (contents, props changed)
Modified:
  head/bin/sh/parser.c
  head/bin/sh/tests/builtins/Makefile

Modified: head/bin/sh/parser.c
==============================================================================
--- head/bin/sh/parser.c	Fri Oct  3 17:27:30 2014	(r272481)
+++ head/bin/sh/parser.c	Fri Oct  3 20:24:56 2014	(r272482)
@@ -1279,6 +1279,13 @@ readcstyleesc(char *out)
 				c = pgetc();
 			if (c == PEOF)
 				synerror("Unterminated quoted string");
+			if (c == '\n') {
+				plinno++;
+				if (doprompt)
+					setprompt(2);
+				else
+					setprompt(0);
+			}
 		}
 		pungetc();
 		return out;

Modified: head/bin/sh/tests/builtins/Makefile
==============================================================================
--- head/bin/sh/tests/builtins/Makefile	Fri Oct  3 17:27:30 2014	(r272481)
+++ head/bin/sh/tests/builtins/Makefile	Fri Oct  3 20:24:56 2014	(r272482)
@@ -100,6 +100,7 @@ FILES+=		jobid2.0
 FILES+=		kill1.0 kill2.0
 FILES+=		lineno.0 lineno.0.stdout
 FILES+=		lineno2.0
+FILES+=		lineno3.0 lineno3.0.stdout
 FILES+=		local1.0
 FILES+=		local2.0
 FILES+=		local3.0

Added: head/bin/sh/tests/builtins/lineno3.0
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/bin/sh/tests/builtins/lineno3.0	Fri Oct  3 20:24:56 2014	(r272482)
@@ -0,0 +1,6 @@
+# $FreeBSD$
+
+echo before: $LINENO
+dummy=$'a\0
+'
+echo after: $LINENO

Added: head/bin/sh/tests/builtins/lineno3.0.stdout
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/bin/sh/tests/builtins/lineno3.0.stdout	Fri Oct  3 20:24:56 2014	(r272482)
@@ -0,0 +1,2 @@
+before: 3
+after: 6


More information about the svn-src-head mailing list