summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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