about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBart Schaefer <barts@users.sourceforge.net>2001-09-25 17:37:54 +0000
committerBart Schaefer <barts@users.sourceforge.net>2001-09-25 17:37:54 +0000
commit5fdcd3a2b46866aeafa99c980608577b21b470de (patch)
tree78d91fe9d66b52d1f7a8c18226129ae6254bb95c
parentae9c181d6ba34c4f9db425f22b642c7bd22e4a79 (diff)
downloadzsh-5fdcd3a2b46866aeafa99c980608577b21b470de.tar.gz
zsh-5fdcd3a2b46866aeafa99c980608577b21b470de.tar.xz
zsh-5fdcd3a2b46866aeafa99c980608577b21b470de.zip
Equivalence of $(...) and `...` in ${(e)...}.
-rw-r--r--ChangeLog5
-rw-r--r--Src/subst.c13
-rw-r--r--Test/D04parameter.ztst11
3 files changed, 22 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 60ca41dc9..ea66ea20e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2001-09-25  Bart Schaefer  <schaefer@zsh.org>
+
+	* 15871, 15872: Src/subst.c, Test/D04parameter.ztst: Equivalence
+	of `...` and $(...) in parameter substitutions, e.g. ${(e)...}.
+
 2001-09-25  Sven Wischnowsky  <wischnow@zsh.org>
 
 	* 15868, 15869: Src/text.c: job text building code couldn't handle
diff --git a/Src/subst.c b/Src/subst.c
index 8bd1a1ae3..4ed6e5e45 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -133,7 +133,7 @@ stringsubst(LinkList list, LinkNode node, int ssub, int asssub)
 		str3 = (char *)getdata(node);
 		continue;
 	    }
-	} else if ((qt = c == Qtick) || c == Tick)
+	} else if ((qt = c == Qtick) || (c == Tick ? (mult_isarr = 1) : 0))
 	  comsub: {
 	    LinkList pl;
 	    char *s, *str2 = str;
@@ -724,9 +724,12 @@ subst_parse_str(char **sp, int single, int err)
             int qt = 0;
 
 	    for (; *s; s++)
-		if (!qt && *s == Qstring)
-		    *s = String;
-                else if (*s == Dnull)
+		if (!qt) {
+		    if (*s == Qstring)
+			*s = String;
+		    else if (*s == Qtick)
+			*s = Tick;
+                } else if (*s == Dnull)
                     qt = !qt;
 	}
 	return 0;
@@ -1492,7 +1495,7 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
             /* 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
+             * they are because subst_parse_str() turns Qstring tokens
              * into String tokens and for unquoted parameter expansions the
              * lexer normally does tokenize patterns inside parameter
              * expansions). */
diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst
index 01d71dbc5..37b5a1897 100644
--- a/Test/D04parameter.ztst
+++ b/Test/D04parameter.ztst
@@ -212,10 +212,17 @@
 >split me
 >I'm yours
 
-  foo='$(print Howzat)'
-  print ${(e)foo}
+  foo='$(print Howzat usay)'
+  print -l ${(e)foo}
 0:${(e)...}
 >Howzat
+>usay
+
+  foo='`print Howzat usay`'
+  print -l ${(e)foo}
+0:Regress ${(e)...} with backticks (see zsh-workers/15871)
+>Howzat
+>usay
 
   foo='I'\''m nearly out of my mind with tedium'
   bar=foo