From 59e79dc026bfcbd500575457e22494d93cff38f2 Mon Sep 17 00:00:00 2001 From: Martijn Dekker Date: Wed, 6 Jul 2022 20:21:37 +0200 Subject: [PATCH] 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. --- src/cmd/ksh93/sh/parse.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/cmd/ksh93/sh/parse.c b/src/cmd/ksh93/sh/parse.c index 9747b53eb..af73da062 100644 --- a/src/cmd/ksh93/sh/parse.c +++ b/src/cmd/ksh93/sh/parse.c @@ -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) {