lua-users home
lua-l archive

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


> lines operates on streams, which on most platforms these days only operate
> in binary mode anyway.

What has "most platforms" got to do with anything? The criteria for inclusion
is "conforms to the the C89 standard", not "works on most platforms".

> My popular system Linux -running most internet servers and such you know-
> does not know about text files and treads all bytes equally. So do all the
> BSD, Mac OS X and whatnot.

Well the standard does make a distinction between text files and binary files,
as does Windows.

>> 3. \0 is not whitespace.
> Is there an official standard for this?

Yes, the C standard:

"white-space characters are the following: space (' '), form feed
('\f'), new-line
('\n'), carriage return ('\r'), horizontal tab ('\t'), and vertical
tab ('\v'). In the
"C" locale, isspace returns true only for the standard white-space characters."

(ISO/IEC 9899:1999 §7.4.2.1)

> I just want everything the C library returned in the string. And I did not
> complain, I proposed working patches to do so.

Also known as "implementation defined behaviour" or "not standard".

> The next time you parse a text file which accidental has a \0 somewhere you
> probably want this bug fix, too ;-) Especially after you spend hours to
> figure out what is going on, ...

Or you could just use the 4 line alternative I already posted in this thread.