summaryrefslogtreecommitdiffstats
path: root/bin/sh/parser.c
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2009-11-14 22:08:32 +0000
committerjilles <jilles@FreeBSD.org>2009-11-14 22:08:32 +0000
commit6655f1214ac30cf0a54e74be98803f8e2e02aa4c (patch)
tree2126dfcd9ac27fc8b6d6d502f33139419737a913 /bin/sh/parser.c
parent3579059b778aedda16c1d467ccc2dd42a542e11e (diff)
downloadFreeBSD-src-6655f1214ac30cf0a54e74be98803f8e2e02aa4c.zip
FreeBSD-src-6655f1214ac30cf0a54e74be98803f8e2e02aa4c.tar.gz
sh: Allow a newline before "in" in a for command, as required by POSIX.
Diffstat (limited to 'bin/sh/parser.c')
-rw-r--r--bin/sh/parser.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/bin/sh/parser.c b/bin/sh/parser.c
index 8dd1e7a..46f5199 100644
--- a/bin/sh/parser.c
+++ b/bin/sh/parser.c
@@ -364,7 +364,9 @@ TRACE(("expecting DO got %s %s\n", tokname[got], got == TWORD ? wordtext : ""));
n1 = (union node *)stalloc(sizeof (struct nfor));
n1->type = NFOR;
n1->nfor.var = wordtext;
- if (readtoken() == TWORD && ! quoteflag && equal(wordtext, "in")) {
+ while (readtoken() == TNL)
+ ;
+ if (lasttoken == TWORD && ! quoteflag && equal(wordtext, "in")) {
app = &ap;
while (readtoken() == TWORD) {
n2 = (union node *)stalloc(sizeof (struct narg));
OpenPOWER on IntegriCloud