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

Re: Here-strings and $functions



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@xxxxxxxxxxxxxxxxxxxxxxx



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