diff options
author | Brian Somers <brian@FreeBSD.org> | 2001-04-09 12:46:19 +0000 |
---|---|---|
committer | Brian Somers <brian@FreeBSD.org> | 2001-04-09 12:46:19 +0000 |
commit | b785bd7d3ba581400e96c38b5c948b59a50e0b42 (patch) | |
tree | 579e5981354478d5714a9270af2cf2f6d0a0674d | |
parent | 3bf5344663e0bad43d2b239484218cfea3a243d0 (diff) | |
download | src-b785bd7d3ba581400e96c38b5c948b59a50e0b42.tar.gz src-b785bd7d3ba581400e96c38b5c948b59a50e0b42.zip |
``|'' should be more binding than ``!'' so that this isn't broken:
if ! echo bla | wc -c ; then
echo broken
fi
Obtained from: NetBSD
Notes
Notes:
svn path=/head/; revision=75336
-rw-r--r-- | bin/sh/parser.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/bin/sh/parser.c b/bin/sh/parser.c index 0c9a202271bd..e1c05720a167 100644 --- a/bin/sh/parser.c +++ b/bin/sh/parser.c @@ -253,10 +253,15 @@ andor() { STATIC union node * pipeline() { - union node *n1, *pipenode; + union node *n1, *n2, *pipenode; struct nodelist *lp, *prev; + int negate; + negate = 0; TRACE(("pipeline: entered\n")); + while (readtoken() == TNOT) + negate = !negate; + tokpushback++; n1 = command(); if (readtoken() == TPIPE) { pipenode = (union node *)stalloc(sizeof (struct npipe)); @@ -275,7 +280,13 @@ pipeline() { n1 = pipenode; } tokpushback++; - return n1; + if (negate) { + n2 = (union node *)stalloc(sizeof (struct nnot)); + n2->type = NNOT; + n2->nnot.com = n1; + return n2; + } else + return n1; } |