bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cut loadable outputs extra newlines


From: Martin D Kealey
Subject: Re: cut loadable outputs extra newlines
Date: Sun, 14 Aug 2022 12:06:20 +1000

I note that
https://pubs.opengroup.org/onlinepubs/009696699/utilities/cut.html says:
*> The elements in list can be repeated, can overlap, and can be specified
in any order, but the bytes, characters, or fields selected shall be
written in the order of the input data.*

The intention behind this is so that cut can be implemented as a small
state machine using just getchar, putchar, and a counter. This avoids
copying via a line buffer, and that implies there should be no line-length
limit.

So I'm a bit surprised that any kind of "getline" is used by the loadable
version.

-Martin

PS: Other equivalent implementations are possible that can also avoid the
stdio buffer copies.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]