summaryrefslogtreecommitdiff
path: root/Src/cond.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/cond.c')
-rw-r--r--Src/cond.c11
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);