]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(main): Avoid setmode; use POSIX-specified routines instead.
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 11 Jul 2005 18:27:10 +0000 (18:27 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 11 Jul 2005 18:27:10 +0000 (18:27 +0000)
src/tr.c

index edbd2c786371bbe6f5b485ad941a60cfa08de093..ffeec20f1b885f5325744f73923970416ace6ab9 100644 (file)
--- a/src/tr.c
+++ b/src/tr.c
@@ -1761,7 +1761,10 @@ 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).  */
-  SET_BINARY2 (STDIN_FILENO, STDOUT_FILENO);
+  if (O_BINARY && ! isatty (STDIN_FILENO))
+    freopen (NULL, "rb", stdin);
+  if (O_BINARY && ! isatty (STDOUT_FILENO))
+    freopen (NULL, "wb", stdout);
 
   if (squeeze_repeats && non_option_args == 1)
     {