summaryrefslogtreecommitdiff
path: root/src/tr.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2005-07-11 18:27:10 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2005-07-11 18:27:10 +0000
commit07fc234838d4bae0ddaa98ead2233ba2c98a1979 (patch)
tree7d8af8f2d1378e3d98b7b516f8ed1917591b83f5 /src/tr.c
parenta1170668ff7ff2f348f801b086fb2561dadeb226 (diff)
downloadcoreutils-07fc234838d4bae0ddaa98ead2233ba2c98a1979.tar.xz
(main): Avoid setmode; use POSIX-specified routines instead.
Diffstat (limited to 'src/tr.c')
-rw-r--r--src/tr.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/tr.c b/src/tr.c
index edbd2c786..ffeec20f1 100644
--- 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)
{