From 1993a3cd2a7b479530da8f37f6fb3ea05a0efb71 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Tue, 13 Sep 2016 09:42:24 +0100 Subject: 39292: Distinguish "=" and "==" tests in output. This is both in xtrace output and shell code rebuilt from internal structures. --- Src/cond.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'Src/cond.c') diff --git a/Src/cond.c b/Src/cond.c index 0381fe94b..f25ebd4a3 100644 --- a/Src/cond.c +++ b/Src/cond.c @@ -34,7 +34,7 @@ int tracingcond; /* updated by execcond() in exec.c */ static char *condstr[COND_MOD] = { - "!", "&&", "||", "==", "!=", "<", ">", "-nt", "-ot", "-ef", "-eq", + "!", "&&", "||", "=", "==", "!=", "<", ">", "-nt", "-ot", "-ef", "-eq", "-ne", "-lt", "-gt", "-le", "-ge", "=~" }; @@ -196,7 +196,8 @@ evalcond(Estate state, char *fromtest) cond_subst(&left, !fromtest); untokenize(left); } - if (ctype <= COND_GE && ctype != COND_STREQ && ctype != COND_STRNEQ) { + if (ctype <= COND_GE && ctype != COND_STREQ && ctype != COND_STRDEQ && + ctype != COND_STRNEQ) { right = ecgetstr(state, EC_DUPTOK, &htok); if (htok) { cond_subst(&right, !fromtest); @@ -208,7 +209,8 @@ evalcond(Estate state, char *fromtest) fputc(' ',xtrerr); quotedzputs(left, xtrerr); fprintf(xtrerr, " %s ", condstr[ctype]); - if (ctype == COND_STREQ || ctype == COND_STRNEQ) { + if (ctype == COND_STREQ || ctype == COND_STRDEQ || + ctype == COND_STRNEQ) { char *rt = dupstring(ecrawstr(state->prog, state->pc, NULL)); cond_subst(&rt, !fromtest); quote_tokenized_output(rt, xtrerr); @@ -287,6 +289,7 @@ evalcond(Estate state, char *fromtest) switch (ctype) { case COND_STREQ: + case COND_STRDEQ: case COND_STRNEQ: { int test, npat = state->pc[1]; @@ -313,7 +316,7 @@ evalcond(Estate state, char *fromtest) state->pc += 2; test = (pprog && pattry(pprog, left)); - return !(ctype == COND_STREQ ? test : !test); + return !(ctype == COND_STRNEQ ? !test : test); } case COND_STRLT: return !(strcmp(left, right) < 0); -- cgit 1.4.1