about summary refs log tree commit diff
path: root/Src/subst.c
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>2000-02-29 16:04:29 +0000
committerTanaka Akira <akr@users.sourceforge.net>2000-02-29 16:04:29 +0000
commitdd02ad2a8621e2be160c6042e283202285799c28 (patch)
tree2109de390e7a1cf8447d32970231397589ffd9cd /Src/subst.c
parent7cc67a8a3702af11f7cda5fc18e19f8c75fffd54 (diff)
downloadzsh-dd02ad2a8621e2be160c6042e283202285799c28.tar.gz
zsh-dd02ad2a8621e2be160c6042e283202285799c28.tar.xz
zsh-dd02ad2a8621e2be160c6042e283202285799c28.zip
zsh-workers/9937
Diffstat (limited to 'Src/subst.c')
-rw-r--r--Src/subst.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/Src/subst.c b/Src/subst.c
index 62ff69beb..1d4ace65e 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -428,7 +428,7 @@ strcatsub(char **d, char *pb, char *pe, char *src, int l, char *s, int glbsub,
     int pl = pe - pb;
 
     if (!pl && (!s || !*s)) {
-	dest = (*d = (copied ? src : dupstring(src)));
+	*d = dest = (copied ? src : dupstring(src));
 	if (glbsub)
 	    tokenize(dest);
     } else {
@@ -701,9 +701,13 @@ get_intarg(char **s)
 
 /* Parsing for the (e) flag. */
 
-static int
-subst_parse_str(char *s, int single)
+static char *
+subst_parse_str(char **sp, int single)
 {
+    char *s;
+
+    *sp = s = dupstring(*sp);
+
     if (!parsestr(s)) {
 	if (!single) {
 	    for (; *s; s++)
@@ -1788,7 +1792,7 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
 		if (prenum || postnum)
 		    x = dopadding(x, prenum, postnum, preone, postone,
 				  premul, postmul);
-		if (eval && subst_parse_str(x, (qt && !nojoin)))
+		if (eval && subst_parse_str(&x, (qt && !nojoin)))
 		    return NULL;
 		xlen = strlen(x);
 		for (tn = firstnode(&tl);
@@ -1824,7 +1828,7 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
 	    if (prenum || postnum)
 		x = dopadding(x, prenum, postnum, preone, postone,
 			      premul, postmul);
-	    if (eval && subst_parse_str(x, (qt && !nojoin)))
+	    if (eval && subst_parse_str(&x, (qt && !nojoin)))
 		return NULL;
 	    xlen = strlen(x);
 	    strcatsub(&y, ostr, aptr, x, xlen, NULL, globsubst, copied);
@@ -1839,7 +1843,7 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
 		if (prenum || postnum)
 		    x = dopadding(x, prenum, postnum, preone, postone,
 				  premul, postmul);
-		if (eval && subst_parse_str(x, (qt && !nojoin)))
+		if (eval && subst_parse_str(&x, (qt && !nojoin)))
 		    return NULL;
 		if (qt && !*x && isarr != 2)
 		    y = dupstring(nulstring);
@@ -1855,7 +1859,7 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
 	    if (prenum || postnum)
 		x = dopadding(x, prenum, postnum, preone, postone,
 			      premul, postmul);
-	    if (eval && subst_parse_str(x, (qt && !nojoin)))
+	    if (eval && subst_parse_str(&x, (qt && !nojoin)))
 		return NULL;
 	    xlen = strlen(x);
 	    *str = strcatsub(&y, aptr, aptr, x, xlen, fstr, globsubst, copied);
@@ -1874,7 +1878,7 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
 	if (prenum || postnum)
 	    x = dopadding(x, prenum, postnum, preone, postone,
 			  premul, postmul);
-	if (eval && subst_parse_str(x, (qt && !nojoin)))
+	if (eval && subst_parse_str(&x, (qt && !nojoin)))
 	    return NULL;
 	xlen = strlen(x);
 	*str = strcatsub(&y, ostr, aptr, x, xlen, fstr, globsubst, copied);