From fa633171fd280096280628887947eb6a0dac3de7 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Tue, 10 Jan 2006 16:57:02 +0000 Subject: 22151: bug outputting here-strings from which etc. when already quoted --- Src/text.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'Src/text.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(' '); -- cgit 1.4.1