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