aboutsummaryrefslogtreecommitdiff
path: root/bin/sh/parser.c
diff options
context:
space:
mode:
authorsvn2git <svn2git@FreeBSD.org>1994-05-01 08:00:00 +0000
committersvn2git <svn2git@FreeBSD.org>1994-05-01 08:00:00 +0000
commita16f65c7d117419bd266c28a1901ef129a337569 (patch)
tree2626602f66dc3551e7a7c7bc9ad763c3bc7ab40a /bin/sh/parser.c
parent8503f4f13f77abf7adc8f7e329c6f9c1d52b6a20 (diff)
This commit was manufactured to restore the state of the 1.1-RELEASE image. Releases prior to 5.3-RELEASE are omitting the secure/ and crypto/ subdirs.
Diffstat (limited to 'bin/sh/parser.c')
-rw-r--r--bin/sh/parser.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/bin/sh/parser.c b/bin/sh/parser.c
index dc0e046ea171..1ab8751d0c7e 100644
--- a/bin/sh/parser.c
+++ b/bin/sh/parser.c
@@ -352,10 +352,11 @@ TRACE(("expecting DO got %s %s\n", tokname[got], got == TWORD ? wordtext : ""));
n2->narg.backquote = NULL;
n2->narg.next = NULL;
n1->nfor.args = n2;
- /* A newline or semicolon is optional here. Anything
- else gets pushed back so we can read it again. */
- if (lasttoken != TNL && lasttoken != TSEMI)
- tokpushback++;
+ /* Many shells accept an optional semicolon here, but
+ POSIX says we should not, so we don't. An optional
+ newline is OK here, but that is handled by the
+ checkkwd = 2 assignment below. */
+ tokpushback++;
}
checkkwd = 2;
if ((t = readtoken()) == TDO)
@@ -429,7 +430,10 @@ TRACE(("expecting DO got %s %s\n", tokname[got], got == TWORD ? wordtext : ""));
checkkwd = 1;
break;
/* Handle an empty command like other simple commands. */
+ case TSEMI:
case TNL:
+ /* Handle EOF like other simple commands, too. */
+ case TEOF:
case TWORD:
tokpushback++;
return simplecmd(rpp, redir);