about summary refs log tree commit diff
path: root/Src/utils.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/utils.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/utils.c')
-rw-r--r--Src/utils.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/Src/utils.c b/Src/utils.c
index 7f3ddad40..9669944f6 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -2376,7 +2376,7 @@ zstrtol_underscore(const char *s, char **t, int base, int underscore)
     while (inblank(*s))
 	s++;
 
-    if ((neg = (*s == '-')))
+    if ((neg = IS_DASH(*s)))
 	s++;
     else if (*s == '+')
 	s++;
@@ -6118,7 +6118,9 @@ quotedzputs(char const *s, FILE *stream)
 	} else
 	    *ptr++ = '\'';
 	while(*s) {
-	    if (*s == Meta)
+	    if (*s == Dash)
+		c = '-';
+	    else if (*s == Meta)
 		c = *++s ^ 32;
 	    else
 		c = *s;
@@ -6155,7 +6157,9 @@ quotedzputs(char const *s, FILE *stream)
     } else {
 	/* use Bourne-style quoting, avoiding empty quoted strings */
 	while (*s) {
-	    if (*s == Meta)
+	    if (*s == Dash)
+		c = '-';
+	    else if (*s == Meta)
 		c = *++s ^ 32;
 	    else
 		c = *s;