summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--Src/string.c2
-rw-r--r--Src/subst.c20
3 files changed, 17 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index 009addd39..f0b3f11c1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-02-02  Peter Stephenson  <p.w.stephenson@ntlworld.com>
+
+	* 23143: Src/string.c, Src/subst.c: =-expansion failed
+	when there were metacharacters in the following string,
+	but still tried to expand it.  It now succeeds.
+
 2007-02-01  Peter Stephenson  <pws@csr.com>
 
 	* unposted: Src/Sched.c: using 23142 turned up sched bug:
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;