[TUHS] non-Posix input files

Chet Ramey via TUHS tuhs at tuhs.org
Fri Mar 28 04:52:59 AEST 2025


On 3/27/25 2:45 PM, Clem Cole wrote:
> 
> Branden Robin wrote:
> 
> 
>      >> info groff gives semantics for including nonempty files that don't end
>      >> with newline. Such files violate the Posix definition of text file.
> 
> 
> Not so fast.   POSIX does not define a text file (that's an ANSI C-ism - 
> thank you DOS -- more in minute).

It does.

"3.387 Text File

A file that contains characters organized into zero or more lines. The
lines do not contain NUL characters and none can exceed {LINE_MAX} bytes in
length, including the <newline> character. Although POSIX.1-2024 does not
distinguish between text files and binary files (see the ISO C standard),
many utilities only produce predictable or meaningful output when operating 
on text files. The standard utilities that have such restrictions always 
specify "text files" in their STDIN or INPUT FILES sections."

https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/V1_chap03.html#tag_03_387

A line is defined as:

"3.185 Line

A sequence of zero or more non-<newline> characters plus a terminating
<newline> character."

https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/V1_chap03.html#tag_03_185

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet at case.edu    http://tiswww.cwru.edu/~chet/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 203 bytes
Desc: OpenPGP digital signature
URL: <http://www.tuhs.org/pipermail/tuhs/attachments/20250327/8df16255/attachment.sig>


More information about the TUHS mailing list