* More brokenness of here-docs in `functions' output
@ 2001-08-16 3:13 Bart Schaefer
2001-08-16 8:46 ` Sven Wischnowsky
0 siblings, 1 reply; 2+ messages in thread
From: Bart Schaefer @ 2001-08-16 3:13 UTC (permalink / raw)
To: zsh-workers
Consider:
threedocs() {
cat <<EOF
this is $path
EOF
cat <<\EOF
this is $path
EOF
cat <<-EOF
this is $path
EOF
}
This function executes correctly, printing:
this is /home/schaefer/bin /usr/local/bin etc. etc.
this is $path
this is /home/schaefer/bin /usr/local/bin etc. etc.
But look at the output of `functions threedocs':
threedocs () {
cat <<< 'this is $path'
cat <<< 'this is $path'
cat <<< 'this is $path'
}
Oops.
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
^ permalink raw reply [flat|nested] 2+ messages in thread
* More brokenness of here-docs in `functions' output
2001-08-16 3:13 More brokenness of here-docs in `functions' output Bart Schaefer
@ 2001-08-16 8:46 ` Sven Wischnowsky
0 siblings, 0 replies; 2+ messages in thread
From: Sven Wischnowsky @ 2001-08-16 8:46 UTC (permalink / raw)
To: zsh-workers
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@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2001-08-16 8:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-16 3:13 More brokenness of here-docs in `functions' output Bart Schaefer
2001-08-16 8:46 ` Sven Wischnowsky
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).