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

This commit is contained in:
Jilles Tjoelker 2014-10-03 20:24:56 +00:00
parent 8b58e6af3c
commit 068dfa2d43
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=272482
4 changed files with 16 additions and 0 deletions

View File

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

View File

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

View File

@ -0,0 +1,6 @@
# $FreeBSD$
echo before: $LINENO
dummy=$'a\0
'
echo after: $LINENO

View File

@ -0,0 +1,2 @@
before: 3
after: 6