From 948f015df0fee27f4e2c73b442a75c9434702550 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Fri, 14 Mar 2008 11:40:57 +0000 Subject: 24711: fix re-presentation of here-documents munged internally to here-strings --- Src/text.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'Src/text.c') diff --git a/Src/text.c b/Src/text.c index 593c25776..7fdc5757f 100644 --- a/Src/text.c +++ b/Src/text.c @@ -831,17 +831,22 @@ getredirs(LinkList redirs) taddstr(fstr[f->type]); if (f->type != REDIR_MERGEIN && f->type != REDIR_MERGEOUT) taddchr(' '); - if (f->type == REDIR_HERESTR && !has_token(f->name)) { + if (f->type == REDIR_HERESTR && + (f->flags & REDIRF_FROM_HEREDOC)) { /* * 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). + * now. If tokens are present we need to do double quoting. */ - taddchr('\''); - taddstr(quotestring(f->name, NULL, QT_SINGLE)); - taddchr('\''); + if (!has_token(f->name)) { + taddchr('\''); + taddstr(quotestring(f->name, NULL, QT_SINGLE)); + taddchr('\''); + } else { + taddchr('"'); + taddstr(quotestring(f->name, NULL, QT_DOUBLE)); + taddchr('"'); + } } else taddstr(f->name); taddchr(' '); -- cgit 1.4.1