Argh -- I standard corrected. We worked hard at the beginning to keep that
crap out -- sigh.
But at least is does says: POSIX.1-2024 *does not **distinguish between
text files and binary files* (see the ISO C standard)
So my point is the same: don't blame POSIX- this is an ANSI C issue, and
utilities really should not care.
ᐧ
On Thu, Mar 27, 2025 at 2:53 PM Chet Ramey <chet.ramey(a)case.edu> wrote:
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#ta…
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#ta…
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet(a)case.edu
http://tiswww.cwru.edu/~chet/