Use binary mode for the testsuite. Needed for mingw build.
diff --git a/ChangeLog b/ChangeLog
index bbb61ec..9332205 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2004-01-23 Bruno Haible <bruno@clisp.org>
+
+ * tests/table-from.c: Include binary-io.h.
+ (main): Switch stdout to binary mode.
+ * tests/table-to.c: Include binary-io.h.
+ (main): Switch stdout to binary mode.
+ * tests/genutf8.c: Include binary-io.h.
+ (main): Switch stdout to binary mode.
+ * tests/Makefile.in (INCLUDES): Also look in srclib.
+ (check): Pass INCLUDES when compiling genutf8.c.
+ * tests/Makefile.os2 (INCLUDES): Also look in srclib.
+ (genutf8.exe): Pass INCLUDES when compiling genutf8.c.
+ * tests/Makefile.msvc (INCLUDES): Also look in srclib.
+ (check): Pass INCLUDES when compiling genutf8.c.
+
2004-01-21 Bruno Haible <bruno@clisp.org>
* src/iconv.c (force_binary): Remove variable.
diff --git a/tests/Makefile.in b/tests/Makefile.in
index fb2b891..112f14f 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -10,7 +10,7 @@
CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
-INCLUDES = -I. -I$(srcdir) -I../include -I$(srcdir)/../include -I../lib
+INCLUDES = -I. -I$(srcdir) -I../include -I$(srcdir)/../include -I../srclib -I$(srcdir)/../srclib -I../lib
LIBTOOL = @LIBTOOL@
LIBTOOL_COMPILE = $(LIBTOOL) --mode=compile
LIBTOOL_LINK = $(LIBTOOL) --mode=link
@@ -31,7 +31,7 @@
check : all table-from table-to ../src/iconv_no_i18n
$(srcdir)/check-stateless $(srcdir) ASCII
# /* General multi-byte encodings */
- $(CC) $(LDFLAGS) $(CFLAGS) $(CPPFLAGS) $(srcdir)/genutf8.c -o genutf8 && \
+ $(CC) $(LDFLAGS) $(INCLUDES) $(CFLAGS) $(CPPFLAGS) $(srcdir)/genutf8.c -o genutf8 && \
./genutf8 > UTF-8.TXT && \
$(srcdir)/check-stateless . UTF-8 && \
$(RM) genutf8 UTF-8.TXT
diff --git a/tests/Makefile.msvc b/tests/Makefile.msvc
index d597e7c..2420c2c 100644
--- a/tests/Makefile.msvc
+++ b/tests/Makefile.msvc
@@ -39,7 +39,7 @@
# Programs used by "make":
CC = cl
CFLAGS = $(MFLAGS) -W1 $(OPTIMFLAGS)
-INCLUDES = -I. -I..\include -I..\lib
+INCLUDES = -I. -I..\include -I..\srclib -I..\lib
RM = -del
#### End of system configuration section. ####
@@ -57,7 +57,7 @@
check : all table-from.exe table-to.exe ../src/iconv.exe uniq-u.exe
$(srcdir)\check-stateless.bat $(srcdir) ASCII
# /* General multi-byte encodings */
- $(CC) $(CFLAGS) $(srcdir)\genutf8.c -Fegenutf8.exe
+ $(CC) $(INCLUDES) $(CFLAGS) $(srcdir)\genutf8.c -Fegenutf8.exe
$(RM) genutf8.obj
.\genutf8 > UTF-8.TXT
$(srcdir)\check-stateless.bat . UTF-8
diff --git a/tests/Makefile.os2 b/tests/Makefile.os2
index 98266df..f2066a3 100644
--- a/tests/Makefile.os2
+++ b/tests/Makefile.os2
@@ -9,7 +9,7 @@
# Programs used by "make":
CC = gcc
CFLAGS = -O2 -Zmtd
-INCLUDES = -I. -I../include -I../lib
+INCLUDES = -I. -I../include -I../srclib -I../lib
#### End of system configuration section. ####
@@ -136,7 +136,7 @@
copy ..\lib\iconv.dll iconv.dll
genutf8.exe : genutf8.c
- $(CC) $(CFLAGS) genutf8.c
+ $(CC) $(INCLUDES) $(CFLAGS) genutf8.c
mostlyclean : clean
diff --git a/tests/genutf8.c b/tests/genutf8.c
index 8a55e69..e020743 100644
--- a/tests/genutf8.c
+++ b/tests/genutf8.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2004 Free Software Foundation, Inc.
This file is part of the GNU LIBICONV Library.
The GNU LIBICONV Library is free software; you can redistribute it
@@ -21,10 +21,16 @@
#include <stdio.h>
#include <stdlib.h>
+#include "binary-io.h"
+
int main ()
{
int i1, i2, i3;
+#if O_BINARY
+ SET_BINARY(fileno(stdout));
+#endif
+
/* Range 0x0000..0x007f */
for (i1 = 0; i1 < 0x80; i1++)
printf("0x%02X\t0x%04X\n", i1, i1);
diff --git a/tests/table-from.c b/tests/table-from.c
index b4315f2..b824ad5 100644
--- a/tests/table-from.c
+++ b/tests/table-from.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2002 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2002, 2004 Free Software Foundation, Inc.
This file is part of the GNU LIBICONV Library.
The GNU LIBICONV Library is free software; you can redistribute it
@@ -27,6 +27,8 @@
#include <iconv.h>
#include <errno.h>
+#include "binary-io.h"
+
/* If nonzero, ignore conversions outside Unicode plane 0. */
static int bmp_only;
@@ -106,6 +108,10 @@
}
charset = argv[1];
+#if O_BINARY
+ SET_BINARY(fileno(stdout));
+#endif
+
cd = iconv_open("UCS-4-INTERNAL",charset);
if (cd == (iconv_t)(-1)) {
perror("iconv_open");
diff --git a/tests/table-to.c b/tests/table-to.c
index 4dbd12c..f97edcc 100644
--- a/tests/table-to.c
+++ b/tests/table-to.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2002 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2002, 2004 Free Software Foundation, Inc.
This file is part of the GNU LIBICONV Library.
The GNU LIBICONV Library is free software; you can redistribute it
@@ -27,6 +27,8 @@
#include <iconv.h>
#include <errno.h>
+#include "binary-io.h"
+
int main (int argc, char* argv[])
{
const char* charset;
@@ -39,6 +41,10 @@
}
charset = argv[1];
+#if O_BINARY
+ SET_BINARY(fileno(stdout));
+#endif
+
cd = iconv_open(charset,"UCS-4-INTERNAL");
if (cd == (iconv_t)(-1)) {
perror("iconv_open");