[TUHS] non-Posix input files
G. Branden Robinson
g.branden.robinson at gmail.com
Fri Mar 28 06:08:19 AEST 2025
Hi Doug,
At 2025-03-27T15:50:50-0400, Douglas McIlroy wrote:
> It seems my reply to Clem went astray. POSIX Part 2, Shell and
> Utilities, is very clear:
>
> 2..2.2.181 text file: A File that contains characters organized into
> one or more lines.
> The lines shall not contain NUL characters ...
>
> 2.2.2.95 line: A sequence of zero or more non-<newline> characters
> plus a terminating <newline> character,
>
> Oddly--and in my opinion wrongly--the standard excludes empty files.
> It would be a shock if an editor or groff refused to process an empty
> file and thereby broke Kernighan's law, "Do nothing gracefully".
I think I can claim that GNU troff has long upheld that principle.
$ printf '' | ~/groff-HEAD/bin/groff | grep . || echo NO OUTPUT
NO OUTPUT
$ printf '' | ~/groff-1.23.0/bin/groff | grep . || echo NO OUTPUT
NO OUTPUT
$ printf '' | ~/groff-1.22.4/bin/groff | grep . || echo NO OUTPUT
NO OUTPUT
$ printf '' | ~/groff-1.22.3/bin/groff | grep . || echo NO OUTPUT
NO OUTPUT
That carries us back through over 10 years of groff development. I'd
bet it's been the case since 1991. Maybe earlier.
Regards,
Branden
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://www.tuhs.org/pipermail/tuhs/attachments/20250327/21661f2b/attachment.sig>
More information about the TUHS
mailing list