1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

parse.c: eliminate global flag (re: 06e56251)

inout() initialises its 'token' variable to the value of
lexp->token. So when inout() returns upon finding a process
subtitution, lexp->token is known to contain either IPROCSYM or
OPROCSYM; simple() can check for that instead, making a global flag
unnecessary.

The fact that inout() calls itself recursively to process multiple
redirections does not influence this because the recursive call is
done right before returning from the current call.
This commit is contained in:
Martijn Dekker 2022-07-06 20:21:37 +02:00
parent fbfd4d3ab8
commit 59e79dc026

View file

@ -48,7 +48,6 @@ static Shnode_t *makeparent(Lex_t*, int, Shnode_t*);
static Shnode_t *makelist(Lex_t*, int, Shnode_t*, Shnode_t*);
static struct argnod *qscan(struct comnod*, int);
static struct ionod *inout(Lex_t*,struct ionod*, int);
static char inout_found_procsub;
static Shnode_t *sh_cmd(Lex_t*,int,int);
static Shnode_t *term(Lex_t*,int);
static Shnode_t *list(Lex_t*,int);
@ -1657,7 +1656,7 @@ static Shnode_t *simple(Lex_t *lexp,int flag, struct ionod *io)
}
else
t->comio = io = inout(lexp,(struct ionod*)0,0);
if(inout_found_procsub)
if((tok = lexp->token)==IPROCSYM || tok==OPROCSYM)
goto procsub;
}
}
@ -1758,7 +1757,7 @@ static struct ionod *inout(Lex_t *lexp,struct ionod *lastio,int flag)
char *iovname=0;
register int errout=0;
/* return if a process substitution is found without a redirection */
if(inout_found_procsub = (token==IPROCSYM || token==OPROCSYM))
if(token==IPROCSYM || token==OPROCSYM)
return(lastio);
if(token==IOVNAME)
{