about summary refs log tree commit diff
path: root/Src/subst.c
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-04-15 18:25:40 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-04-15 18:25:40 +0000
commit8ceb54fbc2f879e0e80f58c18761bd54db07e5f7 (patch)
treed97bf208b73d5385b174c454e4f41839dc421d25 /Src/subst.c
parent6c1fb551ba0973c9a86e1ea479d553d66c6bf6b7 (diff)
downloadzsh-8ceb54fbc2f879e0e80f58c18761bd54db07e5f7.tar.gz
zsh-8ceb54fbc2f879e0e80f58c18761bd54db07e5f7.tar.xz
zsh-8ceb54fbc2f879e0e80f58c18761bd54db07e5f7.zip
Diffstat (limited to 'Src/subst.c')
-rw-r--r--Src/subst.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/Src/subst.c b/Src/subst.c
index c62fcce6b..e8e22f943 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -1361,16 +1361,24 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
 			 NULL, s[-1]);
 		    return NULL;
 		}
-	    singsub(&s);
+	    {
+		char t = s[-1];
+
+		singsub(&s);
+		if (t == '/' && (flags & SUB_SUBSTR)) {
+		    if (*s == '#' || *s == '%') {
+			flags &= ~SUB_SUBSTR;
+			if (*s == '%')
+			    flags |= SUB_END;
+			s++;
+		    } else if (*s == '\\') {
+			s++;
+		    }
+		}
+	    }
 
 	    if (!vunset && isarr) {
-		char **ap = aval;
-		char **pp = aval = (char **)ncalloc(sizeof(char *) * (arrlen(aval) + 1));
-
-		while ((*pp = *ap++)) {
-		    if (getmatch(pp, s, flags, flnum, replstr))
-			pp++;
-		}
+		getmatcharr(&aval, s, flags, flnum, replstr);
 		copied = 1;
 	    } else {
 		if (vunset)