🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #1835

Re: Yet another digression (was Re: [meta] O tempora, o mores! (was Re: does an expression in a logical statement need parenthes...

#1835
From: Tristan Wibberley
Date: Wed, 25 Nov 2026 17:43
64 lines
4443 bytes
On 25/11/2026 00:50, Keith Thompson wrote:
> Here's what POSIX says.
> 
> https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/V1_chap03.html
> 
>     3.185 Line
>     A sequence of zero or more non-<newline> characters plus a
>     terminating <newline> character.
> 
>     3.387 Text File
>     A file that contains characters organized into zero or more
...


> 
> But there are text-like files that don't end in a newline character
> (or that have lines exceeding LINE_MAX bytes), and I expect the
> tools I use to deal with such files reasonably, even if POSIX
> does't require it.
> 

Interestingly 'file(1)' here doesn't describe the largest text file as a
text file even with -k, but it would be useful to recognise and report
it as such.

$ cpp -include limits.h -P <<<LINE_MAX
2048
$ wc -l *file
   1 bigtextfile
   1 toobigfile
   2 total
$ wc -c *file
2048 bigtextfile
2049 toobigfile
4097 total
$ xxd bigtextfile | tail -n2
000007e0: 6161 6161 6161 6161 6161 6161 6161 6161  aaaaaaaaaaaaaaaa
000007f0: 6161 6161 6161 6161 6161 6161 6161 610a  aaaaaaaaaaaaaaa.
$ xxd toobigfile | tail -n2
000007f0: 6161 6161 6161 6161 6161 6161 6161 6161  aaaaaaaaaaaaaaaa
00000800: 0a                                       .
$ file -k *file
bigtextfile: ASCII text, with very long lines (2047)
toobigfile:  ASCII text, with very long lines (2048)

Note I read the specification as LINE_MAX bytes including the newline
character.

Interestingly the spec says "bytes" not "characters". I wonder if it is
using the age-old definition of "byte" being the size of a character (as
in C) or the modern popular one of "octet".

-- 
Tristan Wibberley

The message body is Copyright (C) 2026 Tristan Wibberley except
citations and quotations noted. All Rights Reserved except that you may,
of course, cite it academically giving credit to me, distribute it
verbatim as part of a usenet system or its archives, and use it to
promote my greatness and general superiority without misrepresentation
of my opinions other than my opinion of my greatness and general
superiority which you _may_ misrepresent. You definitely MAY NOT train
any production AI system with it but you may train experimental AI that
will only be used for evaluation of the AI methods it implements.
Technical Details
Message-ID: <11e76nm$3vhpd$1@dont-email.me>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
References: <11cj4a0$23796$1@dont-email.me> <JzOdnc2k5ZGeHmD3nZ2dnZfqn_qdnZ2d@giganews.com> <11dl9ou$1p00u$1@kst.eternal-september.org> <11dm94c$21u9i$1@dont-email.me> <11dmbq9$s03n$7@dont-email.me> <11dmhg2$24tb6$1@dont-email.me> <11dmib8$s03n$9@dont-email.me> <11dmqbl$289i4$1@dont-email.me> <11dmu0s$s03n$10@dont-email.me> <11dmuv3$2a3c0$1@dont-email.me> <11dnr4c$2lhv9$1@kst.eternal-september.org> <11doth7$2vhee$1@dont-email.me> <11dqpqg$3masv$2@dont-email.me> <11drvdj$12fg$1@dont-email.me> <11dt66g$fjb5$2@dont-email.me> <11dui6a$scjp$1@dont-email.me> <SpOcnXL7lP_FgJ72nZ2dnZfqn_idnZ2d@giganews.com> <RdadnUbexs0JvZ72nZ2dnZfqnPednZ2d@giganews.com> <11e136t$f9ab$1@dont-email.me> <11e331r$2gekc$1@dont-email.me> <11e3bhk$2a7k9$1@dont-email.me> <11e5bcb$3as5s$1@kst.eternal-september.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: Tristan Wibberley <tristan.wibberley+netnews2@alumni.manchester.ac.uk>
Newsgroups: comp.lang.c
Subject: Re: Yet another digression (was Re: [meta] O tempora, o mores! (was
 Re: does an expression in a logical statement need parenthesis for proper
 evaluation?))
Date: Wed, 25 Nov 2026 17:43:17 +0000
Organization: A noiseless patient Spider
Lines: 64
Message-ID: <11e76nm$3vhpd$1@dont-email.me>
References: <11cj4a0$23796$1@dont-email.me>
 <JzOdnc2k5ZGeHmD3nZ2dnZfqn_qdnZ2d@giganews.com>
 <11dl9ou$1p00u$1@kst.eternal-september.org> <11dm94c$21u9i$1@dont-email.me>
 <11dmbq9$s03n$7@dont-email.me> <11dmhg2$24tb6$1@dont-email.me>
 <11dmib8$s03n$9@dont-email.me> <11dmqbl$289i4$1@dont-email.me>
 <11dmu0s$s03n$10@dont-email.me> <11dmuv3$2a3c0$1@dont-email.me>
 <11dnr4c$2lhv9$1@kst.eternal-september.org> <11doth7$2vhee$1@dont-email.me>
 <11dqpqg$3masv$2@dont-email.me> <11drvdj$12fg$1@dont-email.me>
 <11dt66g$fjb5$2@dont-email.me> <11dui6a$scjp$1@dont-email.me>
 <SpOcnXL7lP_FgJ72nZ2dnZfqn_idnZ2d@giganews.com>
 <RdadnUbexs0JvZ72nZ2dnZfqnPednZ2d@giganews.com>
 <11e136t$f9ab$1@dont-email.me> <11e331r$2gekc$1@dont-email.me>
 <11e3bhk$2a7k9$1@dont-email.me> <11e5bcb$3as5s$1@kst.eternal-september.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 25 Nov 2026 17:43:19 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="4179757"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1918UWotteOot4KnvEG6WOUFktXXSIr2D9Xy8sbkTgzCw=="; posting-host="dfc066120328088802f3c2e1b5de57ef"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:fyVRu1fFO2JXyAqs9hFhT1hOc4M= sha256:4CtSnNhLWhVhSXuBG0wM0ro1ZUKksubS5b4OYz5lM38=
	sha1:UPJS50qLiV70bPa2p1zpo84V6MQ= sha256:J5FPG9Rfo27WexZhn2Qdo/gkQKHqnUjq7G3JYdxLFz4=
In-Reply-To: <11e5bcb$3as5s$1@kst.eternal-september.org>
Content-Language: en-GB