summaryrefslogtreecommitdiffstats
path: root/bin/sh/parser.c
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>2001-04-09 12:46:19 +0000
committerbrian <brian@FreeBSD.org>2001-04-09 12:46:19 +0000
commit758d5927b5c38ba6a14bbd7d5b2c16baffa9b848 (patch)
treed85a9a4ae80c6f8b63f33dce338fccddab5a7d49 /bin/sh/parser.c
parente8d6cf8f4b769dfbd3f03a2c0e97e9c4e1ac4894 (diff)
downloadFreeBSD-src-758d5927b5c38ba6a14bbd7d5b2c16baffa9b848.zip
FreeBSD-src-758d5927b5c38ba6a14bbd7d5b2c16baffa9b848.tar.gz
``|'' should be more binding than ``!'' so that this isn't broken:
if ! echo bla | wc -c ; then echo broken fi Obtained from: NetBSD
Diffstat (limited to 'bin/sh/parser.c')
-rw-r--r--bin/sh/parser.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/bin/sh/parser.c b/bin/sh/parser.c
index 0c9a202..e1c0572 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;
}
OpenPOWER on IntegriCloud