From: John Kelly on
On Mon, 28 Jun 2010 23:39:59 +0100, Big and Blue <No_4(a)dsl.pipex.com>
wrote:

>> John Kelly<jak(a)isp2dial.com> writes:
>>
>>> This code reads STDIN and remembers the first non-empty line. That's
>>> all it cares about.
>>>
>>> But it also keeps reading till EOF, acting like the "cat" utility, to
>>> flush the extra input and avoid broken pipe errors.
>>>
>>> But reading line by line, just to throw away the unwanted garbage, is
>>> inefficient. I would like to jump out of the loop and "bulk flush" the
>>> remaining input stream.
>
>exec a fork() of cat >/dev/null?

I sometimes use that idea in shell scripts, though at the cost of an
extra pid.

But I'm not sure if it would be more efficient than a perl loop with a
fixed buffer size.



--
Web mail, POP3, and SMTP
http://www.beewyz.com/freeaccounts.php