summaryrefslogtreecommitdiff
path: root/Src/cond.c
diff options
context:
space:
mode:
authorAxel Beckert <abe@deuxchevaux.org>2016-12-04 04:32:03 +0100
committerAxel Beckert <abe@deuxchevaux.org>2016-12-04 04:32:03 +0100
commit3e439c3863f14c82f70666804c8570a13b3732e6 (patch)
tree07036c43e0f3f9242bb6dd42cd2a849ec8ea8aca /Src/cond.c
parent2aedc4b88fd0e87b89583983951b04b96f48efd3 (diff)
parent7b7e84f0815ed22a0ee348a217776529035dccf3 (diff)
downloadzsh-3e439c3863f14c82f70666804c8570a13b3732e6.tar.gz
zsh-3e439c3863f14c82f70666804c8570a13b3732e6.zip
Merge tag 'zsh-5.2-test-1' into debian
Diffstat (limited to 'Src/cond.c')
-rw-r--r--Src/cond.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/Src/cond.c b/Src/cond.c
index c5ab65eea..42e9de30f 100644
--- a/Src/cond.c
+++ b/Src/cond.c
@@ -30,10 +30,11 @@
#include "zsh.mdh"
#include "cond.pro"
-int tracingcond;
+/**/
+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", "=~"
};
@@ -195,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);
@@ -207,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);
@@ -286,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];
@@ -312,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);
@@ -347,6 +351,8 @@ evalcond(Estate state, char *fromtest)
return (!S_ISSOCK(dostat(left)));
case 'u':
return (!(dostat(left) & S_ISUID));
+ case 'v':
+ return (!issetvar(left));
case 'w':
return (!doaccess(left, W_OK));
case 'x':