From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12584 invoked from network); 24 Jul 2001 08:12:37 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 24 Jul 2001 08:12:37 -0000 Received: (qmail 16916 invoked by alias); 24 Jul 2001 08:12:30 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 15470 Received: (qmail 16904 invoked from network); 24 Jul 2001 08:12:30 -0000 From: Sven Wischnowsky Date: Tue, 24 Jul 2001 10:12:04 +0200 (MET DST) Message-Id: <200107240812.KAA13057@beta.informatik.hu-berlin.de> To: zsh-workers@sunsite.dk Subject: Re: Here-strings and $functions In-Reply-To: <1010724061840.ZM15617@candle.brasslantern.com> Bart Schaefer wrote: > ... > > gets converted internally into a REDIR_HERESTR, and so does the original > example with <<<. But in the case of <<<, THE QUOTES ARE STILL PART OF > THE STRING, as \230 tokens. For <<-, there are no quotes. So when we > arrive in getredirs(), in the <<- case we need to insert quotes and then > call bslashquote(), but in the <<< case we only need to untokenize(). > > The only way to get this right is to know whether the original code was > really a here-string, or actually a full-fledged here-document; but > that information isn't passed down to getredirs() -- I'm not even sure > whether it's available in gettext2(). > > Otherwise we need to change the way <<< here-strings are parsed, so that > they're stored untokenized and with quotes stripped. Err... it would be enough to just remnulargs() for here strings, wouldn't it? At least it seems to work. Just in case I missed something I won't commit this just now (although I tried <<<, <<-, << and <<'EOF'). Bye Sven Index: Src/parse.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/parse.c,v retrieving revision 1.28 diff -u -r1.28 parse.c --- Src/parse.c 2001/07/09 16:05:14 1.28 +++ Src/parse.c 2001/07/24 08:10:33 @@ -1685,6 +1685,9 @@ if ((tokstr[0] == Inang || tokstr[0] == Outang) && tokstr[1] == Inpar) type = tokstr[0] == Inang ? REDIR_INPIPE : REDIR_OUTPIPE; break; + case REDIR_HERESTR: + remnulargs(name = dupstring(name)); + break; } yylex(); -- Sven Wischnowsky wischnow@informatik.hu-berlin.de