about summary refs log tree commit diff
path: root/Src/subst.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2004-06-28 15:38:10 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2004-06-28 15:38:10 +0000
commit7f26993e99cccf2d56958643b8eb369625f04726 (patch)
tree5523268c14d2d86b41b842be5737a167f181f93a /Src/subst.c
parent81d27b662a4e65665f8cfb41a629a92181769506 (diff)
downloadzsh-7f26993e99cccf2d56958643b8eb369625f04726.tar.gz
zsh-7f26993e99cccf2d56958643b8eb369625f04726.tar.xz
zsh-7f26993e99cccf2d56958643b8eb369625f04726.zip
20112 changed c.f. 20113:
fix here string and here document expansion and quoting
Diffstat (limited to 'Src/subst.c')
-rw-r--r--Src/subst.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/Src/subst.c b/Src/subst.c
index 189ecda6e..da3db5844 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -231,6 +231,36 @@ stringsubst(LinkList list, LinkNode node, int ssub, int asssub)
     return errflag ? NULL : node;
 }
 
+/*
+ * Simplified version of the prefork/singsub processing where
+ * we only do substitutions appropriate to quoting.  Currently
+ * this means only the expansions in $'....'.  This is used
+ * for the end tag for here documents.  As we are not doing
+ * `...` expansions, we just use those for quoting.  However,
+ * they stay in the text.  This is weird, but that's not
+ * my fault.
+ *
+ * The remnulargs() makes this consistent with the other forms
+ * of substitution, indicating that quotes have been fully
+ * processed.
+ */
+
+/**/
+void
+quotesubst(char *str)
+{
+    char *s = str;
+
+    while (*s) {
+	if (*s == String && s[1] == Snull) {
+	    s = getkeystring(s, NULL, 4, NULL);
+	} else {
+	    s++;
+	}
+    }
+    remnulargs(str);
+}
+
 /**/
 mod_export void
 globlist(LinkList list, int nountok)