diff options
author | Claudio Bley <claudio.bley@gmail.com> | 2011-09-04 18:01:57 +0200 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2011-10-04 13:55:49 +0200 |
commit | 7508234eabe646abcea074baea83612f8115d3b9 (patch) | |
tree | b0bf6be05a18d98d5ad32dd840ea11b84993fd3c | |
parent | 11ef88af927a4591aa54bc86814c0ed11b6025be (diff) | |
download | diffutils-7508234eabe646abcea074baea83612f8115d3b9.tar.gz |
portability: use SET_BINARY rather than xfreopen (NULL, ...
* src/diff.c: Include binary-io.h, not xfreopen.h.
(main): Use SET_BINARY (...) rather than xfreopen (NULL, X, ...),
because the latter doesn't work on MinGW and crashes using MSVC.
* src/cmp.c (main): Likewise.
-rw-r--r-- | bootstrap.conf | 1 | ||||
-rw-r--r-- | src/cmp.c | 4 | ||||
-rw-r--r-- | src/diff.c | 6 |
3 files changed, 6 insertions, 5 deletions
diff --git a/bootstrap.conf b/bootstrap.conf index cc6d88c..c4e340e 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -19,6 +19,7 @@ # gnulib modules used by this package. gnulib_modules=' announce-gen +binary-io c-stack config-h diffseq @@ -33,7 +33,7 @@ #include <unlocked-io.h> #include <version-etc.h> #include <xalloc.h> -#include <xfreopen.h> +#include <binary-io.h> #include <xstrtol.h> /* The official name of this program (e.g., no `g' prefix). */ @@ -293,7 +293,7 @@ main (int argc, char **argv) { file_desc[f1] = STDIN_FILENO; if (O_BINARY && ! isatty (STDIN_FILENO)) - xfreopen (NULL, "rb", stdin); + SET_BINARY (STDIN_FILENO); } else file_desc[f1] = open (file[f1], O_RDONLY | O_BINARY, 0); @@ -39,7 +39,7 @@ #include <timespec.h> #include <version-etc.h> #include <xalloc.h> -#include <xfreopen.h> +#include <binary-io.h> /* The official name of this program (e.g., no `g' prefix). */ #define PROGRAM_NAME "diff" @@ -525,7 +525,7 @@ main (int argc, char **argv) #if O_BINARY binary = true; if (! isatty (STDOUT_FILENO)) - xfreopen (NULL, "wb", stdout); + SET_BINARY (STDOUT_FILENO); #endif break; @@ -1108,7 +1108,7 @@ compare_files (struct comparison const *parent, { cmp.file[f].desc = STDIN_FILENO; if (O_BINARY && binary && ! isatty (STDIN_FILENO)) - xfreopen (NULL, "rb", stdin); + SET_BINARY (STDIN_FILENO); if (fstat (STDIN_FILENO, &cmp.file[f].stat) != 0) cmp.file[f].desc = ERRNO_ENCODE (errno); else |