Make --binary the default.
diff --git a/ChangeLog b/ChangeLog
index 7f1e8f4..bbb61ec 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
2004-01-21 Bruno Haible <bruno@clisp.org>
+ * src/iconv.c (force_binary): Remove variable.
+ (usage): Don't document --binary any more.
+ (convert, main): Always switch to binary mode.
+ * tests/check-stateful.bat: Remove --binary option.
+ * tests/check-translit.bat: Likewise.
+ * tests/check-stateful.cmd: Likewise.
+ * tests/check-translit.cmd: Likewise.
+ * djgpp/stateful-check.sed: Remove MODE variable.
+ * djgpp/translit-check.sed: Likewise.
+
+2004-01-21 Bruno Haible <bruno@clisp.org>
+
* man/iconv.3: Fix description of return value in case of error.
Reported by Jonathan Wakely <redi@users.sf.net>.
diff --git a/djgpp/stateful-check.sed b/djgpp/stateful-check.sed
index 019094b..e96681b 100644
--- a/djgpp/stateful-check.sed
+++ b/djgpp/stateful-check.sed
@@ -1,16 +1,11 @@
# Sed script for tests/stateful-check editing.
/set -e/ a\
-# For systems that distinguish between text and binary I/O\
-# the binary mode of iconv must be selected and for\
-# systems with severe filename restrictions allow for\
+# For systems with severe filename restrictions allow for\
# an alternate filename.\
UNAME=${UNAME-`uname 2>/dev/null`}\
case X$UNAME in\
- *-DOS) MODE='--binary'\
- filename=`echo "$charset" | sed "s|ISO-|ISO/|;s|2022-|2022|"` ;;\
- *) MODE=''\
- filename="$charset" ;;\
+ *-DOS) filename=`echo "$charset" | sed "s|ISO-|ISO/|;s|2022-|2022|"` ;;\
+ *) filename="$charset" ;;\
esac
-/iconv/ s/iconv/& $MODE/
s/\$charset"-snippet/$filename"-snippet/g
diff --git a/djgpp/translit-check.sed b/djgpp/translit-check.sed
index faa0ddd..6141c36 100644
--- a/djgpp/translit-check.sed
+++ b/djgpp/translit-check.sed
@@ -1,10 +1 @@
# Sed script for tests/translit-check editing.
-/set -e/ a\
-# For systems that distinguish between text and binary I/O\
-# the binary mode of iconv must be selected.\
-UNAME=${UNAME-`uname 2>/dev/null`}\
-case X$UNAME in\
- *-DOS) MODE='--binary' ;;\
- *) MODE='' ;;\
-esac
-/iconv/ s/iconv/& $MODE/
diff --git a/src/iconv.c b/src/iconv.c
index ff0f6d5..bd2c0e1 100644
--- a/src/iconv.c
+++ b/src/iconv.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2003 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
@@ -45,21 +45,13 @@
#define _(str) gettext(str)
-#if O_BINARY
- static int force_binary = 0;
-#endif
-
static int discard_unconvertible = 0;
static int silent = 0;
static void usage (int exitcode)
{
const char* helpstring1 =
-#if O_BINARY
- _("Usage: iconv [--binary] [-c] [-s] [-f fromcode] [-t tocode] [file ...]");
-#else
_("Usage: iconv [-c] [-s] [-f fromcode] [-t tocode] [file ...]");
-#endif
const char* helpstring2 =
_("or: iconv -l");
fprintf(exitcode ? stderr : stdout, "%s\n%s\n", helpstring1, helpstring2);
@@ -100,8 +92,7 @@
int status = 0;
#if O_BINARY
- if (force_binary)
- SET_BINARY(fileno(infile));
+ SET_BINARY(fileno(infile));
#endif
iconv(cd,NULL,NULL,NULL,NULL);
for (;;) {
@@ -263,8 +254,8 @@
print_version();
}
#if O_BINARY
+ /* Backward compatibility with iconv <= 1.9.1. */
if (!strcmp(argv[i],"--binary")) {
- force_binary = 1;
i++;
continue;
}
@@ -291,8 +282,7 @@
status = 0;
} else {
#if O_BINARY
- if (force_binary)
- SET_BINARY(fileno(stdout));
+ SET_BINARY(fileno(stdout));
#endif
if (fromcode == NULL)
fromcode = "char";
diff --git a/tests/check-stateful.bat b/tests/check-stateful.bat
index a18cf54..b596e75 100644
--- a/tests/check-stateful.bat
+++ b/tests/check-stateful.bat
@@ -2,8 +2,8 @@
REM Simple check of a stateful encoding.
REM Usage: check-stateful.bat SRCDIR CHARSET
-..\src\iconv_no_i18n --binary -f %2 -t UTF-8 < %1\%2-snippet > tmp-snippet
+..\src\iconv_no_i18n -f %2 -t UTF-8 < %1\%2-snippet > tmp-snippet
fc %1\%2-snippet.UTF-8 tmp-snippet
-..\src\iconv_no_i18n --binary -f UTF-8 -t %2 < %1\%2-snippet.UTF-8 > tmp-snippet
+..\src\iconv_no_i18n -f UTF-8 -t %2 < %1\%2-snippet.UTF-8 > tmp-snippet
fc %1\%2-snippet tmp-snippet
del tmp-snippet
diff --git a/tests/check-stateful.cmd b/tests/check-stateful.cmd
index 313f9ee..66d39ce 100644
--- a/tests/check-stateful.cmd
+++ b/tests/check-stateful.cmd
@@ -14,9 +14,9 @@
PARSE ARG srcdir charset
-'..\src\iconv --binary -f 'charset' -t UTF-8 < 'srcdir'\'charset'-snippet > tmp-snippet'
+'..\src\iconv -f 'charset' -t UTF-8 < 'srcdir'\'charset'-snippet > tmp-snippet'
'cmp 'srcdir'\'charset'-snippet.UTF-8 tmp-snippet'
-'..\src\iconv --binary -f UTF-8 -t 'charset' < 'srcdir'\'charset'-snippet.UTF-8 > tmp-snippet'
+'..\src\iconv -f UTF-8 -t 'charset' < 'srcdir'\'charset'-snippet.UTF-8 > tmp-snippet'
'cmp 'srcdir'\'charset'-snippet tmp-snippet'
'rm -f tmp-snippet'
diff --git a/tests/check-translit.bat b/tests/check-translit.bat
index a8f359e..a0fdc6f 100644
--- a/tests/check-translit.bat
+++ b/tests/check-translit.bat
@@ -2,6 +2,6 @@
REM Simple check of transliteration facilities.
REM Usage: check-translit.bat SRCDIR FILE FROMCODE TOCODE
-..\src\iconv_no_i18n --binary -f %3 -t %4//TRANSLIT < %1\%2.%3 > tmp
+..\src\iconv_no_i18n -f %3 -t %4//TRANSLIT < %1\%2.%3 > tmp
fc %1\%2.%4 tmp
del tmp
diff --git a/tests/check-translit.cmd b/tests/check-translit.cmd
index da49e44..55f700a 100644
--- a/tests/check-translit.cmd
+++ b/tests/check-translit.cmd
@@ -14,7 +14,7 @@
PARSE ARG srcdir file fromcode tocode
-'..\src\iconv --binary -f 'fromcode' -t 'tocode'//TRANSLIT < 'srcdir'\'file'.'fromcode' > tmp'
+'..\src\iconv -f 'fromcode' -t 'tocode'//TRANSLIT < 'srcdir'\'file'.'fromcode' > tmp'
'cmp 'srcdir'\'file'.'tocode' tmp'
'rm -f tmp'
EXIT