Hi Anton,
> > $ (printf '.pl 1i\n.ll 2i\n'; yes 'a \n%') | nroff | sed 13q
...
> I can reproduce this on my FreeBSD box, but I cannot figure out how
> this works? Can you really send a never ending stream to nroff?
Sure. It does output-line-at-a-time formatting. Even
paragraph-at-a-time that some troff versions have is presumably limited
to a page?
I see no difference in nroff's memory usage as 1000 increases ten times
each time in
seq 1000 | nroff | LC_ALL=C grep . | tail -1
> And why do you need seq? I get the same result with just head:
> $ ( printf '.pl 1i\n.ll 2i\n' ; yes 'a \n%' ) | nroff | head -n13
Why use head(1)? Why did Berkeley even bother to create head when sed
already existed and had the functionality?
I'm assuming you know about the SIGPIPE, or EPIPE return from write(2),
that occurs when sed closes its stdin, nroff's stdout, and how that
ripples back through the pipeline, causing yes(1) to stop?
Cheers, Ralph.