diff options
Diffstat (limited to 'src/tr.c')
-rw-r--r-- | src/tr.c | 9 |
1 files changed, 3 insertions, 6 deletions
@@ -29,7 +29,7 @@ #include "fadvise.h" #include "quote.h" #include "safe-read.h" -#include "xfreopen.h" +#include "xsetmode.h" #include "xstrtol.h" /* The official name of this program (e.g., no 'g' prefix). */ @@ -1786,11 +1786,8 @@ main (int argc, char **argv) /* Use binary I/O, since 'tr' is sometimes used to transliterate non-printable characters, or characters which are stripped away by text-mode reads (like CR and ^Z). */ - if (O_BINARY && ! isatty (STDIN_FILENO)) - xfreopen (NULL, "rb", stdin); - if (O_BINARY && ! isatty (STDOUT_FILENO)) - xfreopen (NULL, "wb", stdout); - + xsetmode (STDIN_FILENO, O_BINARY); + xsetmode (STDOUT_FILENO, O_BINARY); fadvise (stdin, FADVISE_SEQUENTIAL); if (squeeze_repeats && non_option_args == 1) |