diff options
author | Bruno Haible <bruno@clisp.org> | 2001-02-05 18:41:37 +0000 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2001-02-05 18:41:37 +0000 |
commit | 25c7f881a50ea68d71b96588d04c7920d9201606 (patch) | |
tree | dfe997d8feea5969431ce63c3a44303e8626e8be | |
parent | 1fdb3de89f6349cdb5bc6de495d7b7d25e72d335 (diff) | |
download | external_gettext-25c7f881a50ea68d71b96588d04c7920d9201606.zip external_gettext-25c7f881a50ea68d71b96588d04c7920d9201606.tar.gz external_gettext-25c7f881a50ea68d71b96588d04c7920d9201606.tar.bz2 |
Use O_BINARY where necessary.
-rw-r--r-- | lib/system.h | 23 | ||||
-rw-r--r-- | src/ChangeLog | 5 | ||||
-rw-r--r-- | src/msgfmt.c | 7 | ||||
-rw-r--r-- | src/msgunfmt.c | 5 |
4 files changed, 37 insertions, 3 deletions
diff --git a/lib/system.h b/lib/system.h index 10c2faf..dcec667 100644 --- a/lib/system.h +++ b/lib/system.h @@ -128,4 +128,27 @@ extern char *gnu_basename PARAMS ((const char *)); # define basename(Arg) gnu_basename (Arg) #endif + +#include <fcntl.h> +/* For systems that distinguish between text and binary I/O. + O_BINARY is usually declared in <fcntl.h>. */ +#if !defined O_BINARY && defined _O_BINARY + /* For MSC-compatible compilers. */ +# define O_BINARY _O_BINARY +# define O_TEXT _O_TEXT +#endif +#ifdef __BEOS__ + /* BeOS 5 has O_BINARY and O_TEXT, but they have no effect. */ +# undef O_BINARY +# undef O_TEXT +#endif +#if O_BINARY +# if !(defined(__EMX__) || defined(__DJGPP__)) +# define setmode _setmode +# define fileno _fileno +# endif +#else +# define setmode(fd, mode) /* nothing */ +#endif + #endif diff --git a/src/ChangeLog b/src/ChangeLog index c569b9d..7d9f440 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2001-02-04 Bruno Haible <haible@clisp.cons.org> + + * msgfmt.c (main): Open the output file in binary mode. + * msgunfmt.c (read_mo_file): Open the input file in binary mode. + 2001-01-21 Bruno Haible <haible@clisp.cons.org> Use libtool. diff --git a/src/msgfmt.c b/src/msgfmt.c index 0f653ab..00bab40 100644 --- a/src/msgfmt.c +++ b/src/msgfmt.c @@ -319,7 +319,10 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ if (domain->symbol_tab.filled != 0) { if (strcmp (domain->domain_name, "-") == 0) - output_file = stdout; + { + output_file = stdout; + setmode (fileno (output_file), O_BINARY); + } else { const char *fname; @@ -327,7 +330,7 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ fname = strict_uniforum ? add_mo_suffix (domain->domain_name) : domain->domain_name; - output_file = fopen (fname, "w"); + output_file = fopen (fname, "wb"); if (output_file == NULL) { error (0, errno, diff --git a/src/msgunfmt.c b/src/msgunfmt.c index 3dd2cec..04064d8 100644 --- a/src/msgunfmt.c +++ b/src/msgunfmt.c @@ -348,7 +348,10 @@ read_mo_file (mlp, fn) int j; if (strcmp (fn, "-") == 0 || strcmp (fn, "/dev/stdin") == 0) - fp = stdin; + { + fp = stdin; + setmode (fileno (fp), O_BINARY); + } else { fp = fopen (fn, "rb"); |