union node;
struct ncmd {
- int type;
+ smallint type; /* Nxxxx */
union node *assign;
union node *args;
union node *redirect;
};
struct npipe {
- int type;
- int backgnd;
+ smallint type;
+ smallint pipe_backgnd;
struct nodelist *cmdlist;
};
struct nredir {
- int type;
+ smallint type;
union node *n;
union node *redirect;
};
struct nbinary {
- int type;
+ smallint type;
union node *ch1;
union node *ch2;
};
struct nif {
- int type;
+ smallint type;
union node *test;
union node *ifpart;
union node *elsepart;
};
struct nfor {
- int type;
+ smallint type;
union node *args;
union node *body;
char *var;
};
struct ncase {
- int type;
+ smallint type;
union node *expr;
union node *cases;
};
struct nclist {
- int type;
+ smallint type;
union node *next;
union node *pattern;
union node *body;
};
struct narg {
- int type;
+ smallint type;
union node *next;
char *text;
struct nodelist *backquote;
};
struct nfile {
- int type;
+ smallint type;
union node *next;
int fd;
union node *fname;
};
struct ndup {
- int type;
+ smallint type;
union node *next;
int fd;
int dupfd;
};
struct nhere {
- int type;
+ smallint type;
union node *next;
int fd;
union node *doc;
};
struct nnot {
- int type;
+ smallint type;
union node *com;
};
union node {
- int type;
+ smallint type;
struct ncmd ncmd;
struct npipe npipe;
struct nredir nredir;
if (lp->next)
fputs(" | ", fp);
}
- if (n->npipe.backgnd)
+ if (n->npipe.pipe_backgnd)
fputs(" &", fp);
if (ind >= 0)
putc('\n', fp);
static void
redirect(union node *redir, int flags)
{
- union node *n;
struct redirtab *sv;
int i;
int fd;
sv->renamed[i] = EMPTY;
g_nullredirs = 0;
}
- n = redir;
do {
- fd = n->nfile.fd;
- if ((n->nfile.type == NTOFD || n->nfile.type == NFROMFD)
- && n->ndup.dupfd == fd)
+ fd = redir->nfile.fd;
+ if ((redir->nfile.type == NTOFD || redir->nfile.type == NFROMFD)
+ && redir->ndup.dupfd == fd)
continue; /* redirect from/to same file descriptor */
- newfd = openredirect(n);
+ newfd = openredirect(redir);
if (fd == newfd) {
/* Descriptor wasn't open before redirect.
* Mark it for close in the future */
} else {
close(fd);
}
- dupredirect(n, newfd);
- } while ((n = n->nfile.next));
+ dupredirect(redir, newfd);
+ } while ((redir = redir->nfile.next) != NULL);
INT_ON;
if ((flags & REDIR_SAVEFD2) && sv && sv->renamed[2] >= 0)
preverrout_fd = sv->renamed[2];
if (*p == '.')
matchdot++;
while (!intpending && (dp = readdir(dirp)) != NULL) {
- if (dp->d_name[0] == '.' && ! matchdot)
+ if (dp->d_name[0] == '.' && !matchdot)
continue;
if (pmatch(start, dp->d_name)) {
if (atend) {
}
}
closedir(dirp);
- if (! atend)
+ if (!atend)
endname[-1] = '/';
}
break;
case NPIPE:
new->npipe.cmdlist = copynodelist(n->npipe.cmdlist);
- new->npipe.backgnd = n->npipe.backgnd;
+ new->npipe.pipe_backgnd = n->npipe.pipe_backgnd;
break;
case NREDIR:
case NBACKGND:
/* never returns */
}
status = 0;
- if (! backgnd)
+ if (!backgnd)
status = waitforjob(jp);
exitstatus = status;
INT_ON;
ash_msg_and_raise_error("pipe call failed");
}
}
- if (forkshell(jp, lp->n, n->npipe.backgnd) == 0) {
+ if (forkshell(jp, lp->n, n->npipe.pipe_backgnd) == 0) {
INT_ON;
if (pip[1] >= 0) {
close(pip[0]);
prevfd = pip[0];
close(pip[1]);
}
- if (n->npipe.backgnd == 0) {
+ if (n->npipe.pipe_backgnd == 0) {
exitstatus = waitforjob(jp);
TRACE(("evalpipe: job done exit status %d\n", exitstatus));
}
tok = readtoken();
if (tok == TBACKGND) {
if (n2->type == NPIPE) {
- n2->npipe.backgnd = 1;
+ n2->npipe.pipe_backgnd = 1;
} else {
if (n2->type != NREDIR) {
n3 = stzalloc(sizeof(struct nredir));
if (readtoken() == TPIPE) {
pipenode = stzalloc(sizeof(struct npipe));
pipenode->type = NPIPE;
- /*pipenode->npipe.backgnd = 0; - stzalloc did it */
+ /*pipenode->npipe.pipe_backgnd = 0; - stzalloc did it */
lp = stzalloc(sizeof(struct nodelist));
pipenode->npipe.cmdlist = lp;
lp->n = n1;
break;
}
case TFOR:
- if (readtoken() != TWORD || quoteflag || ! goodname(wordtext))
+ if (readtoken() != TWORD || quoteflag || !goodname(wordtext))
raise_error_syntax("Bad for loop variable");
n1 = stzalloc(sizeof(struct nfor));
n1->type = NFOR;
--NUMPTR;
numptr_val = rez;
if (op == TOK_CONDITIONAL) {
- if (! numptr_m1->contidional_second_val_initialized) {
+ if (!numptr_m1->contidional_second_val_initialized) {
/* protect $((expr1 ? expr2)) without ": expr" */
goto err;
}
}
for (o = expr; *p && *o == *p; p++)
o++;
- if (! *p) {
+ if (!*p) {
/* found */
expr = o - 1;
break;