about summary refs log tree commit diff
path: root/Src/cond.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2017-03-07 10:43:58 +0000
committerPeter Stephenson <pws@zsh.org>2017-03-07 10:43:58 +0000
commitf3f8537cfa05414ad14494e809d9ebfeef86ebbc (patch)
treecfb02314dd129609ef3d6fc85ce75fc63b8c9582 /Src/cond.c
parenta8345a40b1a79bb3a5c524ccf5fedf78040ae40e (diff)
downloadzsh-f3f8537cfa05414ad14494e809d9ebfeef86ebbc.tar.gz
zsh-f3f8537cfa05414ad14494e809d9ebfeef86ebbc.tar.xz
zsh-f3f8537cfa05414ad14494e809d9ebfeef86ebbc.zip
40760: Always tokenize unquoted - to Dash.
This fixes use of pattern match character ranges in unusual contexts.

Attempt to detect a tokenized - in cases where we don't care.
Diffstat (limited to 'Src/cond.c')
-rw-r--r--Src/cond.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/Src/cond.c b/Src/cond.c
index 8ab019307..9b739f6c1 100644
--- a/Src/cond.c
+++ b/Src/cond.c
@@ -138,13 +138,13 @@ evalcond(Estate state, char *fromtest)
 		strs = arrdup(sbuf);
 		l = 2;
 	    }
-	    if (name && name[0] == '-')
+	    if (name && IS_DASH(name[0]))
 		errname = name;
-	    else if (strs[0] && *strs[0] == '-')
+	    else if (strs[0] && IS_DASH(*strs[0]))
 		errname = strs[0];
 	    else
 		errname = "<null>";
-	    if (name && name[0] == '-' &&
+	    if (name && IS_DASH(name[0]) &&
 		(cd = getconddef((ctype == COND_MODI), name + 1, 1))) {
 		if (ctype == COND_MOD &&
 		    (l < cd->min || (cd->max >= 0 && l > cd->max))) {
@@ -171,7 +171,7 @@ evalcond(Estate state, char *fromtest)
 		strs[0] = dupstring(name);
 		name = s;
 
-		if (name && name[0] == '-' &&
+		if (name && IS_DASH(name[0]) &&
 		    (cd = getconddef(0, name + 1, 1))) {
 		    if (l < cd->min || (cd->max >= 0 && l > cd->max)) {
 			zwarnnam(fromtest, "unknown condition: %s",