about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2007-02-02 21:42:14 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2007-02-02 21:42:14 +0000
commit54d692c4b557eecbb15d0ba4814fa99902ab3008 (patch)
tree0f8002764070f951674462e5cb0e79e1840ea883 /Src
parent56085ffebb9776b663e2562d71425662d6d6a13f (diff)
downloadzsh-54d692c4b557eecbb15d0ba4814fa99902ab3008.tar.gz
zsh-54d692c4b557eecbb15d0ba4814fa99902ab3008.tar.xz
zsh-54d692c4b557eecbb15d0ba4814fa99902ab3008.zip
23143: make =-expansion with metacharacters more consistent
Diffstat (limited to 'Src')
-rw-r--r--Src/string.c2
-rw-r--r--Src/subst.c20
2 files changed, 11 insertions, 11 deletions
diff --git a/Src/string.c b/Src/string.c
index 6a381ca30..190ca2d57 100644
--- a/Src/string.c
+++ b/Src/string.c
@@ -135,7 +135,7 @@ bicat(const char *s1, const char *s2)
     return ptr;
 }
 
-/* like strdup(), but with a specified length */
+/* like dupstring(), but with a specified length */
 
 /**/
 mod_export char *
diff --git a/Src/subst.c b/Src/subst.c
index ea2c50bde..be7b5321c 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -570,21 +570,21 @@ filesubstr(char **namptr, int assign)
 	    return 1;
 	}
     } else if (*str == Equals && isset(EQUALS) && str[1]) {   /* =foo */
-	char sav, *pp, *cnam;
-
-	for (pp = str + 1; !isend2(*pp); pp++);
-	sav = *pp;
-	*pp = 0;
-	if (!(cnam = findcmd(str + 1, 1))) {
+	char *pp, *cnam, *cmdstr, *str1 = str+1;
+
+	for (pp = str1; !isend2(*pp); pp++)
+	    ;
+	cmdstr = dupstrpfx(str1, pp-str1);
+	untokenize(cmdstr);
+	remnulargs(cmdstr);
+	if (!(cnam = findcmd(cmdstr, 1))) {
 	    if (isset(NOMATCH))
-		zerr("%s not found", str + 1);
+		zerr("%s not found", cmdstr);
 	    return 0;
 	}
 	*namptr = dupstring(cnam);
-	if (sav) {
-	    *pp = sav;
+	if (*pp)
 	    *namptr = dyncat(*namptr, pp);
-	}
 	return 1;
     }
     return 0;