about summary refs log tree commit diff
path: root/Src/utils.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2007-01-27 19:01:11 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2007-01-27 19:01:11 +0000
commitdf54eeed2ca4823d57c2bc74fc5def7b3b4a77ae (patch)
tree66dd30eac451d798ddfc6753e86d4967d57786eb /Src/utils.c
parent040db61c325a6523ab50cabc0cd3c5e120413d3c (diff)
downloadzsh-df54eeed2ca4823d57c2bc74fc5def7b3b4a77ae.tar.gz
zsh-df54eeed2ca4823d57c2bc74fc5def7b3b4a77ae.tar.xz
zsh-df54eeed2ca4823d57c2bc74fc5def7b3b4a77ae.zip
23136: handle Bnulls now added in $'...'
Diffstat (limited to 'Src/utils.c')
-rw-r--r--Src/utils.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/Src/utils.c b/Src/utils.c
index 4aa5b0799..c0ccc6715 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -4914,23 +4914,34 @@ getkeystring(char *s, int *len, int how, int *misc)
 	} else if (*s == Meta)
 	    *t++ = *++s ^ 32;
 	else {
-	    *t++ = *s;
 	    if (itok(*s)) {
 		if (meta || control) {
 		    /*
 		     * Presumably we should be using meta or control
 		     * on the character representing the token.
 		     */
-		    *s = ztokens[*s - Pound];
+		    *t++ = ztokens[*s - Pound];
 		} else if (how & GETKEY_DOLLAR_QUOTE) {
-		    /*
-		     * We don't want to metafy this, it's a real
-		     * token.
-		     */
-		    *tdest++ = *s;
+		    if (*s == Bnull) {
+			/*
+			 * Bnull is a backslash which quotes a couple
+			 * of special characters that always appear
+			 * literally next.  See strquote handling
+			 * in gettokstr() in lex.c.
+			 */
+			*tdest++ = *++s;
+		    } else {
+			/*
+			 * We don't want to metafy this, it's a real
+			 * token.
+			 */
+			*tdest++ = *s;
+		    }
 		    continue;
-		}
-	    }
+		} else
+		    *t++ = *s;
+	    } else
+		*t++ = *s;
 	}
 	if (meta == 2) {
 	    t[-1] |= 0x80;