diff options
author | Peter Stephenson <pws@zsh.org> | 2016-09-13 09:42:24 +0100 |
---|---|---|
committer | Peter Stephenson <pws@zsh.org> | 2016-09-13 09:42:24 +0100 |
commit | 1993a3cd2a7b479530da8f37f6fb3ea05a0efb71 (patch) | |
tree | 1b352222ea93c281cddae037a09847439a1ace2f /Src/cond.c | |
parent | 23c1c774b95861209fe97d1436b6563d5946f939 (diff) | |
download | zsh-1993a3cd2a7b479530da8f37f6fb3ea05a0efb71.tar.gz zsh-1993a3cd2a7b479530da8f37f6fb3ea05a0efb71.tar.xz zsh-1993a3cd2a7b479530da8f37f6fb3ea05a0efb71.zip |
39292: Distinguish "=" and "==" tests in output.
This is both in xtrace output and shell code rebuilt from internal structures.
Diffstat (limited to 'Src/cond.c')
-rw-r--r-- | Src/cond.c | 11 |
1 files changed, 7 insertions, 4 deletions
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); |