[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: text vs. binary [Re: more gcc warnings]
From: |
Paul Eggert |
Subject: |
Re: text vs. binary [Re: more gcc warnings] |
Date: |
Tue, 12 Jul 2005 01:10:01 -0700 |
User-agent: |
Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) |
address@hidden (Eric Blake) writes:
> http://lists.gnu.org/archive/html/bug-coreutils/2005-05/msg00136.html
I just looked at that, and don't really follow all the DOS stuff, but
have these comments anyway:
> cat - POSIX requires binary input and output, and this already has -B option
> to fine-tune mode
I've removed -B. It didn't really work on DOS, as far as I could see.
And it wasn't portable (it didn't work on GNU/Linux).
> head - POSIX requires text input, but compare to tail -c on binary input
Currently "head" runs in binary mode (which means, in DOS, that it
uses binary mode except if stdin/stdout is a tty).
> nohup - POSIX requires that stdout from utility may to go to nohup.out, so
> nohup.out should probably be opened in same mode as nohup's stdout (if it
> exists)
nohup.out is currently opened in text mode. Let's just leave that
alone, unless someone really needs it. (I doubt whether they will.)
> I've thought
> more about fcntl(fd, F_SETFL, flags), where the nice gnulib behavior
> would be:
> neither O_BINARY nor O_TEXT: leave mode unchanged
> O_BINARY: if not tty, force binary mode
> O_TEXT: if not tty, force text mode
> O_BINARY | O_TEXT: if not tty, swap mode
My kneejerk reaction is that sounds pretty confusing. But perhaps I
don't see the application area.
>> and have a wrapper on MS-DOS that defines freopen to not do anything
>> if the first argument is NULL, the second ends in "b", and the third a
>> standard tty?
>
> Since POSIX states that "w+b" and "wb+" are synonyms, for example,
OK, use 'contains "b"' instead of 'ends in "b"'.
> I'd like to see a deprecation period rather than outright removal,
> where -B is undocumented, and using it evokes a warning but
> is otherwise a no-op (rather than a fatal unrecognized option).
You could talk me into that, yes.
> Are there non-standard hosts out there that don't treat "ab" as
> a synonym to "a" per POSIX
Yes. At least, such hosts used to exist. Maybe we needn't worry
about them now. I suppose I can rip out the (O_BINARY ? "rb" : r")
stuff. (Though this does save a byte on POSIX hosts. :-)