about summary refs log tree commit diff
path: root/Src/subst.c
diff options
context:
space:
mode:
authorPeter Stephenson <p.w.stephenson@ntlworld.com>2015-12-07 21:49:07 +0000
committerPeter Stephenson <p.w.stephenson@ntlworld.com>2015-12-07 21:49:07 +0000
commitf5b8efa7e0450450a91c8263733502f9de6729b4 (patch)
tree29b5f892a5d76ab66179b0502a25b9f95840093c /Src/subst.c
parent9fb30cf572f7c5ff26e883396a5020da89d9541a (diff)
downloadzsh-f5b8efa7e0450450a91c8263733502f9de6729b4.tar.gz
zsh-f5b8efa7e0450450a91c8263733502f9de6729b4.tar.xz
zsh-f5b8efa7e0450450a91c8263733502f9de6729b4.zip
37344: restore old printable quoting, add ${(q+)...}.
The \C- form is only used inside quotedzputs().

${(q+)...} outputs a quotedzputs() representation.
Diffstat (limited to 'Src/subst.c')
-rw-r--r--Src/subst.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/Src/subst.c b/Src/subst.c
index d9c9d24aa..bb1dd8939 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -1887,12 +1887,13 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags,
 		    if (quotetype == QT_DOLLARS ||
 			quotetype == QT_BACKSLASH_PATTERN)
 			goto flagerr;
-		    if (s[1] == '-') {
+		    if (s[1] == '-' || s[1] == '+') {
 			if (quotemod)
 			    goto flagerr;
 			s++;
 			quotemod = 1;
-			quotetype = QT_SINGLE_OPTIONAL;
+			quotetype = (*s == '-') ? QT_SINGLE_OPTIONAL :
+			    QT_QUOTEDZPUTS;
 		    } else {
 			if (quotetype == QT_SINGLE_OPTIONAL) {
 			    /* extra q's after '-' not allowed */
@@ -3583,7 +3584,10 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags,
 	    ap = aval;
 
 	    if (quotemod > 0) {
-		if (quotetype > QT_BACKSLASH) {
+		if (quotetype == QT_QUOTEDZPUTS) {
+		    for (; *ap; ap++)
+			*ap = quotedzputs(*ap, NULL);
+		} else if (quotetype > QT_BACKSLASH) {
 		    int sl;
 		    char *tmp;
 
@@ -3626,7 +3630,9 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags,
 	    if (!copied)
 		val = dupstring(val), copied = 1;
 	    if (quotemod > 0) {
-		if (quotetype > QT_BACKSLASH) {
+		if (quotetype == QT_QUOTEDZPUTS) {
+		    val = quotedzputs(val, NULL);
+		} else if (quotetype > QT_BACKSLASH) {
 		    int sl;
 		    char *tmp;
 		    tmp = quotestring(val, NULL, quotetype);