Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

More brokenness of here-docs in `functions' output



Bart Schaefer wrote:

> Consider:
> 
> threedocs() {
>   cat <<EOF
> this is $path
> EOF
>   cat <<\EOF
> this is $path
> EOF
>   cat <<-EOF
> 	this is $path
> 	EOF
> }
> 
> ...
> 
> But look at the output of `functions threedocs':
> 
> threedocs () {
>         cat <<< 'this is $path'
>         cat <<< 'this is $path'
>         cat <<< 'this is $path'
> }

We want this to be nice, yes?  So that we have two cases in text.c.


Bye
  Sven

Index: Src/text.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/text.c,v
retrieving revision 1.6
diff -u -r1.6 text.c
--- Src/text.c	2001/06/25 16:07:53	1.6
+++ Src/text.c	2001/08/16 08:43:42
@@ -751,9 +751,15 @@
 	    taddstr(fstr[f->type]);
 	    taddchr(' ');
 	    if (f->type == REDIR_HERESTR) {
-		taddchr('\'');
-		taddstr(bslashquote(f->name, NULL, 1));
-		taddchr('\'');
+                if (has_token(f->name)) {
+                    taddchr('\"');
+                    taddstr(bslashquote(f->name, NULL, 2));
+                    taddchr('\"');
+                } else {
+                    taddchr('\'');
+                    taddstr(bslashquote(f->name, NULL, 1));
+                    taddchr('\'');
+                }
 	    } else
 		taddstr(f->name);
 	    taddchr(' ');

-- 
Sven Wischnowsky                    wischnow@xxxxxxxxxxxxxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author