about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2006-01-10 16:57:02 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2006-01-10 16:57:02 +0000
commitfa633171fd280096280628887947eb6a0dac3de7 (patch)
treec8225a6d66f3530c7f97198c9a3aeddffff85858
parentd09c2868715f63281387743b34b446c9ffc60671 (diff)
downloadzsh-fa633171fd280096280628887947eb6a0dac3de7.tar.gz
zsh-fa633171fd280096280628887947eb6a0dac3de7.tar.xz
zsh-fa633171fd280096280628887947eb6a0dac3de7.zip
22151: bug outputting here-strings from which etc. when already quoted
-rw-r--r--ChangeLog5
-rw-r--r--Src/text.c21
2 files changed, 16 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index ab30d8226..917fbb16e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-01-10  Peter Stephenson  <pws@csr.com>
+
+	* 22151: Src/text.c: a here-string got too many quotes when
+	output by which etc.
+
 2006-01-09  Wayne Davison  <wayned@users.sourceforge.net>
 
 	* unposted: Src/utils.c, Src/Zle/compmatch.c, Src/Zle/zle_utils.c:
diff --git a/Src/text.c b/Src/text.c
index ceb4bfdf4..db24d8c9e 100644
--- a/Src/text.c
+++ b/Src/text.c
@@ -798,16 +798,17 @@ getredirs(LinkList redirs)
 	    taddstr(fstr[f->type]);
 	    if (f->type != REDIR_MERGEIN && f->type != REDIR_MERGEOUT)
 		taddchr(' ');
-	    if (f->type == REDIR_HERESTR) {
-                if (has_token(f->name)) {
-                    taddchr('\"');
-                    taddstr(bslashquote(f->name, NULL, 2));
-                    taddchr('\"');
-                } else {
-                    taddchr('\'');
-                    taddstr(bslashquote(f->name, NULL, 1));
-                    taddchr('\'');
-                }
+	    if (f->type == REDIR_HERESTR && !has_token(f->name)) {
+		/*
+		 * Strings that came from here-documents are converted
+		 * to here strings without quotation, so add that
+		 * now.  If tokens are already present taddstr()
+		 * will do the right thing (anyway, adding more
+		 * quotes certainly isn't right in that case).
+		 */
+		taddchr('\'');
+		taddstr(bslashquote(f->name, NULL, 1));
+		taddchr('\'');
 	    } else
 		taddstr(f->name);
 	    taddchr(' ');