summaryrefslogtreecommitdiff
path: root/src/cat.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cat.c')
-rw-r--r--src/cat.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/cat.c b/src/cat.c
index 001408576..fba721f28 100644
--- a/src/cat.c
+++ b/src/cat.c
@@ -39,7 +39,7 @@
#include "fadvise.h"
#include "full-write.h"
#include "safe-read.h"
-#include "xfreopen.h"
+#include "xsetmode.h"
/* The official name of this program (e.g., no 'g' prefix). */
#define PROGRAM_NAME "cat"
@@ -645,8 +645,7 @@ main (int argc, char **argv)
if (! (number || show_ends || squeeze_blank))
{
file_open_mode |= O_BINARY;
- if (O_BINARY && ! isatty (STDOUT_FILENO))
- xfreopen (NULL, "wb", stdout);
+ xsetmode (STDOUT_FILENO, O_BINARY);
}
/* Check if any of the input files are the same as the output file. */
@@ -665,8 +664,8 @@ main (int argc, char **argv)
{
have_read_stdin = true;
input_desc = STDIN_FILENO;
- if ((file_open_mode & O_BINARY) && ! isatty (STDIN_FILENO))
- xfreopen (NULL, "rb", stdin);
+ if (file_open_mode & O_BINARY)
+ xsetmode (STDIN_FILENO, O_BINARY);
}
else
{