about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2001-05-18 12:39:24 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2001-05-18 12:39:24 +0000
commit11e31474665c0ca7f689457633f72483f3f9f2ad (patch)
treec9b7353cfa4aef29d9d04358fe34db82d8c2d7c2 /Src
parent9a7d4529ea622a9871fe21d40ce53c86a6e6b212 (diff)
downloadzsh-11e31474665c0ca7f689457633f72483f3f9f2ad.tar.gz
zsh-11e31474665c0ca7f689457633f72483f3f9f2ad.tar.xz
zsh-11e31474665c0ca7f689457633f72483f3f9f2ad.zip
try to make ${(e)..} work for complicated parameter expansions in the value; this means: keep Qstring tokens unchanged if they are inside double quotes and tokenizing patterns in parameter expansions (14381)
Diffstat (limited to 'Src')
-rw-r--r--Src/subst.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/Src/subst.c b/Src/subst.c
index 492778400..24103b3da 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -720,9 +720,13 @@ subst_parse_str(char **sp, int single, int err)
 
     if (!(err ? parsestr(s) : parsestrnoerr(s))) {
 	if (!single) {
+            int qt = 0;
+
 	    for (; *s; s++)
-		if (*s == Qstring)
+		if (!qt && *s == Qstring)
 		    *s = String;
+                else if (*s == Dnull)
+                    qt = !qt;
 	}
 	return 0;
     }
@@ -1483,7 +1487,14 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
 	case '#':
 	case Pound:
 	case '/':
-	    if (qt) {
+            /* This once was executed only `if (qt) ...'. But with that
+             * patterns in a expansion resulting from a ${(e)...} aren't
+             * tokenized even though this function thinks they are (it thinks
+             * they are because subst_parse_string() turns Qstring tokens
+             * into String tokens and for unquoted parameter expansions the
+             * lexer normally does tokenize patterns inside parameter
+             * expansions). */
+            {
 		int one = noerrs, oef = errflag, haserr;
 
 		if (!quoteerr)