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

Re: What does REDIRF_FROM_HEREDOC flag represent?



On Thursday, October 21st, 2021 at 16:39, Daniel Shahaf
<d.s@xxxxxxxxxxxxxxxxxx> wrote:

> Welcome :)

Thanks! c:

> > Is it that every line in heredoc is a here-string?
>
> No.

I got that idea from the fact that heredoc and here-string, despite having
separate entries in redirection types enum in zsh.h, share the same case in
exec.c (line 3687) and are both acquired with getherestr function. I saw that
just above this very function is gethere fn with a comment that it converts a
heredoc to a here-string, but I thought that the flag would be set there as
well.

I guess I just got confused and a comment from getherestr that reads "For
here-strings from here documents, we use the original" got me an idea that a
here-string can somehow exist in heredoc (?????) in a very strange fashion. So
I asked to make sure.

Your explanation definitely helped, thank you a ton for that, Daniel!

> It did help that I already knew what each file does in general, but
> yeah, I don't have access to zsh-with-comments.git either ☹

It's surprisingly easy to navigate in the code base, even without entirely
understanding C syntax. So good job keeping it organized!

- Jett




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