Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 3 Oct 2014 20:24:57 +0000 (UTC)
From:      Jilles Tjoelker <jilles@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r272482 - in head/bin/sh: . tests/builtins
Message-ID:  <201410032024.s93KOveM070721@svn.freebsd.org>

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



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