bug-gnulib
[Top][All Lists]
Advanced

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

Re: [PATCH] binary-io: do not treat set_binary_mode() on stdin/out/err a


From: Bruno Haible
Subject: Re: [PATCH] binary-io: do not treat set_binary_mode() on stdin/out/err as an error on OS/2
Date: Thu, 30 May 2019 02:55:57 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-145-generic; KDE/5.18.0; x86_64; ; )

Hi Paul,

> > OK, so tee.c, tr.c etc. ought to contain the equivalent of:
> >
> >    if (! isatty (STDIN_FILENO))
> >      setmode (STDIN_FILENO, O_BINARY);
> >    if (! isatty (STDOUT_FILENO))
> >      setmode (STDOUT_FILENO, O_BINARY);

This code snippet is what we would have to write in every program,
IF THERE WAS NO GNULIB.

> That sounds overly complicated. Can't we arrange to have something 
> simpler, like what we have now?
> 
>    xset_binary_mode (STDIN_FILENO, O_BINARY);
>    xset_binary_mode (STDOUT_FILENO, O_BINARY);
> 
> The idea is that tee.c, tr.c, etc. should not have to worry about 
> calling isatty.

Yes! This is already how the coreutils code looks like, and what I propose
is a patch to gnulib ONLY [1]. It does NOT require changes to coreutils.

Bruno

[1] the second half of
    https://lists.gnu.org/archive/html/bug-gnulib/2019-05/msg00168.html




reply via email to

[Prev in Thread] Current Thread [Next in Thread]