summaryrefslogtreecommitdiff
path: root/src/tr.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1999-01-01 22:40:48 +0000
committerJim Meyering <jim@meyering.net>1999-01-01 22:40:48 +0000
commit87f9e231c340b939bf691842df8fb30e88402acd (patch)
tree9d084aa33924b73968714f688dd12efe6ebd66c7 /src/tr.c
parent8e7da4a47c69fe4f4f78cb917032c331f6fa14a6 (diff)
downloadcoreutils-87f9e231c340b939bf691842df8fb30e88402acd.tar.xz
(main) [O_BINARY]: Use binary I/O when appropriate.
Diffstat (limited to 'src/tr.c')
-rw-r--r--src/tr.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/tr.c b/src/tr.c
index 49b7a228f..88d1700bb 100644
--- a/src/tr.c
+++ b/src/tr.c
@@ -1,5 +1,5 @@
/* tr -- a filter to translate characters
- Copyright (C) 91, 95, 96, 1997, 1998 Free Software Foundation, Inc.
+ Copyright (C) 91, 95, 96, 1997, 1998, 1999 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -1900,6 +1900,11 @@ without squeezing repeats"));
validate (s1, s2);
+ /* 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 (squeeze_repeats && non_option_args == 1)
{
set_initialize (s1, complement, in_squeeze_set);