# 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
+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.
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;
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,
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");