| version 1.64, 2007/01/13 18:58:26 |
version 1.65, 2007/06/07 20:57:59 |
| Line 151 list(int nlflag) |
|
| Line 151 list(int nlflag) |
|
| { |
{ |
| union node *n1, *n2, *n3; |
union node *n1, *n2, *n3; |
| int tok; |
int tok; |
| |
TRACE(("list: entered\n")); |
| |
|
| checkkwd = 2; |
checkkwd = 2; |
| if (nlflag == 0 && tokendlist[peektoken()]) |
if (nlflag == 0 && tokendlist[peektoken()]) |
|
|
| union node *n1, *n2, *n3; |
union node *n1, *n2, *n3; |
| int t; |
int t; |
| |
|
| |
TRACE(("andor: entered\n")); |
| n1 = pipeline(); |
n1 = pipeline(); |
| for (;;) { |
for (;;) { |
| if ((t = readtoken()) == TAND) { |
if ((t = readtoken()) == TAND) { |
|
|
| struct nodelist *lp, *prev; |
struct nodelist *lp, *prev; |
| int negate; |
int negate; |
| |
|
| negate = 0; |
|
| TRACE(("pipeline: entered\n")); |
TRACE(("pipeline: entered\n")); |
| while (readtoken() == TNOT) |
|
| |
negate = 0; |
| |
checkkwd = 2; |
| |
while (readtoken() == TNOT) { |
| |
TRACE(("pipeline: TNOT recognized\n")); |
| negate = !negate; |
negate = !negate; |
| |
} |
| tokpushback++; |
tokpushback++; |
| n1 = command(); |
n1 = command(); |
| if (readtoken() == TPIPE) { |
if (readtoken() == TPIPE) { |
|
|
| } |
} |
| tokpushback++; |
tokpushback++; |
| if (negate) { |
if (negate) { |
| |
TRACE(("negate pipeline\n")); |
| n2 = (union node *)stalloc(sizeof (struct nnot)); |
n2 = (union node *)stalloc(sizeof (struct nnot)); |
| n2->type = NNOT; |
n2->type = NNOT; |
| n2->nnot.com = n1; |
n2->nnot.com = n1; |
|
|
| union node *redir, **rpp; |
union node *redir, **rpp; |
| int t, negate = 0; |
int t, negate = 0; |
| |
|
| |
TRACE(("command: entered\n")); |
| |
|
| checkkwd = 2; |
checkkwd = 2; |
| redir = NULL; |
redir = NULL; |
| n1 = NULL; |
n1 = NULL; |
| Line 517 TRACE(("expecting DO got %s %s\n", tokna |
|
| Line 526 TRACE(("expecting DO got %s %s\n", tokna |
|
| |
|
| checkneg: |
checkneg: |
| if (negate) { |
if (negate) { |
| |
TRACE(("negate command\n")); |
| n2 = (union node *)stalloc(sizeof (struct nnot)); |
n2 = (union node *)stalloc(sizeof (struct nnot)); |
| n2->type = NNOT; |
n2->type = NNOT; |
| n2->nnot.com = n1; |
n2->nnot.com = n1; |
| Line 550 simplecmd(union node **rpp, union node * |
|
| Line 560 simplecmd(union node **rpp, union node * |
|
| orig_rpp = rpp; |
orig_rpp = rpp; |
| |
|
| while (readtoken() == TNOT) { |
while (readtoken() == TNOT) { |
| TRACE(("command: TNOT recognized\n")); |
TRACE(("simplcmd: TNOT recognized\n")); |
| negate = !negate; |
negate = !negate; |
| } |
} |
| tokpushback++; |
tokpushback++; |
| Line 593 simplecmd(union node **rpp, union node * |
|
| Line 603 simplecmd(union node **rpp, union node * |
|
| |
|
| checkneg: |
checkneg: |
| if (negate) { |
if (negate) { |
| |
TRACE(("negate simplecmd\n")); |
| n2 = (union node *)stalloc(sizeof (struct nnot)); |
n2 = (union node *)stalloc(sizeof (struct nnot)); |
| n2->type = NNOT; |
n2->type = NNOT; |
| n2->nnot.com = n; |
n2->nnot.com = n; |
|
|
| out: |
out: |
| checkkwd = (t == TNOT) ? savecheckkwd : 0; |
checkkwd = (t == TNOT) ? savecheckkwd : 0; |
| } |
} |
| #ifdef DEBUG |
TRACE(("%stoken %s %s\n", alreadyseen ? "reread " : "", tokname[t], t == TWORD ? wordtext : "")); |
| if (!alreadyseen) |
|
| TRACE(("token %s %s\n", tokname[t], t == TWORD ? wordtext : "")); |
|
| else |
|
| TRACE(("reread token %s %s\n", tokname[t], t == TWORD ? wordtext : "")); |
|
| #endif |
|
| return (t); |
return (t); |
| } |
} |
| |
|