Skip to content

Commit 12d862d

Browse files
committed
Make --binary the default.
1 parent 753526f commit 12d862d

File tree

8 files changed

+25
-37
lines changed

8 files changed

+25
-37
lines changed

ChangeLog

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
2004-01-21 Bruno Haible <bruno@clisp.org>
2+
3+
* src/iconv.c (force_binary): Remove variable.
4+
(usage): Don't document --binary any more.
5+
(convert, main): Always switch to binary mode.
6+
* tests/check-stateful.bat: Remove --binary option.
7+
* tests/check-translit.bat: Likewise.
8+
* tests/check-stateful.cmd: Likewise.
9+
* tests/check-translit.cmd: Likewise.
10+
* djgpp/stateful-check.sed: Remove MODE variable.
11+
* djgpp/translit-check.sed: Likewise.
12+
113
2004-01-21 Bruno Haible <bruno@clisp.org>
214

315
* man/iconv.3: Fix description of return value in case of error.

djgpp/stateful-check.sed

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
# Sed script for tests/stateful-check editing.
22

33
/set -e/ a\
4-
# For systems that distinguish between text and binary I/O\
5-
# the binary mode of iconv must be selected and for\
6-
# systems with severe filename restrictions allow for\
4+
# For systems with severe filename restrictions allow for\
75
# an alternate filename.\
86
UNAME=${UNAME-`uname 2>/dev/null`}\
97
case X$UNAME in\
10-
*-DOS) MODE='--binary'\
11-
filename=`echo "$charset" | sed "s|ISO-|ISO/|;s|2022-|2022|"` ;;\
12-
*) MODE=''\
13-
filename="$charset" ;;\
8+
*-DOS) filename=`echo "$charset" | sed "s|ISO-|ISO/|;s|2022-|2022|"` ;;\
9+
*) filename="$charset" ;;\
1410
esac
15-
/iconv/ s/iconv/& $MODE/
1611
s/\$charset"-snippet/$filename"-snippet/g

djgpp/translit-check.sed

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1 @@
11
# Sed script for tests/translit-check editing.
2-
/set -e/ a\
3-
# For systems that distinguish between text and binary I/O\
4-
# the binary mode of iconv must be selected.\
5-
UNAME=${UNAME-`uname 2>/dev/null`}\
6-
case X$UNAME in\
7-
*-DOS) MODE='--binary' ;;\
8-
*) MODE='' ;;\
9-
esac
10-
/iconv/ s/iconv/& $MODE/

src/iconv.c

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (C) 2000-2003 Free Software Foundation, Inc.
1+
/* Copyright (C) 2000-2004 Free Software Foundation, Inc.
22
This file is part of the GNU LIBICONV Library.
33
44
The GNU LIBICONV Library is free software; you can redistribute it
@@ -45,21 +45,13 @@
4545

4646
#define _(str) gettext(str)
4747

48-
#if O_BINARY
49-
static int force_binary = 0;
50-
#endif
51-
5248
static int discard_unconvertible = 0;
5349
static int silent = 0;
5450

5551
static void usage (int exitcode)
5652
{
5753
const char* helpstring1 =
58-
#if O_BINARY
59-
_("Usage: iconv [--binary] [-c] [-s] [-f fromcode] [-t tocode] [file ...]");
60-
#else
6154
_("Usage: iconv [-c] [-s] [-f fromcode] [-t tocode] [file ...]");
62-
#endif
6355
const char* helpstring2 =
6456
_("or: iconv -l");
6557
fprintf(exitcode ? stderr : stdout, "%s\n%s\n", helpstring1, helpstring2);
@@ -100,8 +92,7 @@ static int convert (iconv_t cd, FILE* infile, const char* infilename)
10092
int status = 0;
10193

10294
#if O_BINARY
103-
if (force_binary)
104-
SET_BINARY(fileno(infile));
95+
SET_BINARY(fileno(infile));
10596
#endif
10697
iconv(cd,NULL,NULL,NULL,NULL);
10798
for (;;) {
@@ -263,8 +254,8 @@ int main (int argc, char* argv[])
263254
print_version();
264255
}
265256
#if O_BINARY
257+
/* Backward compatibility with iconv <= 1.9.1. */
266258
if (!strcmp(argv[i],"--binary")) {
267-
force_binary = 1;
268259
i++;
269260
continue;
270261
}
@@ -291,8 +282,7 @@ int main (int argc, char* argv[])
291282
status = 0;
292283
} else {
293284
#if O_BINARY
294-
if (force_binary)
295-
SET_BINARY(fileno(stdout));
285+
SET_BINARY(fileno(stdout));
296286
#endif
297287
if (fromcode == NULL)
298288
fromcode = "char";

tests/check-stateful.bat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
REM Simple check of a stateful encoding.
33
REM Usage: check-stateful.bat SRCDIR CHARSET
44

5-
..\src\iconv_no_i18n --binary -f %2 -t UTF-8 < %1\%2-snippet > tmp-snippet
5+
..\src\iconv_no_i18n -f %2 -t UTF-8 < %1\%2-snippet > tmp-snippet
66
fc %1\%2-snippet.UTF-8 tmp-snippet
7-
..\src\iconv_no_i18n --binary -f UTF-8 -t %2 < %1\%2-snippet.UTF-8 > tmp-snippet
7+
..\src\iconv_no_i18n -f UTF-8 -t %2 < %1\%2-snippet.UTF-8 > tmp-snippet
88
fc %1\%2-snippet tmp-snippet
99
del tmp-snippet

tests/check-stateful.cmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ END
1414

1515
PARSE ARG srcdir charset
1616

17-
'..\src\iconv --binary -f 'charset' -t UTF-8 < 'srcdir'\'charset'-snippet > tmp-snippet'
17+
'..\src\iconv -f 'charset' -t UTF-8 < 'srcdir'\'charset'-snippet > tmp-snippet'
1818
'cmp 'srcdir'\'charset'-snippet.UTF-8 tmp-snippet'
19-
'..\src\iconv --binary -f UTF-8 -t 'charset' < 'srcdir'\'charset'-snippet.UTF-8 > tmp-snippet'
19+
'..\src\iconv -f UTF-8 -t 'charset' < 'srcdir'\'charset'-snippet.UTF-8 > tmp-snippet'
2020
'cmp 'srcdir'\'charset'-snippet tmp-snippet'
2121
'rm -f tmp-snippet'
2222

tests/check-translit.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
REM Simple check of transliteration facilities.
33
REM Usage: check-translit.bat SRCDIR FILE FROMCODE TOCODE
44

5-
..\src\iconv_no_i18n --binary -f %3 -t %4//TRANSLIT < %1\%2.%3 > tmp
5+
..\src\iconv_no_i18n -f %3 -t %4//TRANSLIT < %1\%2.%3 > tmp
66
fc %1\%2.%4 tmp
77
del tmp

tests/check-translit.cmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ END
1414

1515
PARSE ARG srcdir file fromcode tocode
1616

17-
'..\src\iconv --binary -f 'fromcode' -t 'tocode'//TRANSLIT < 'srcdir'\'file'.'fromcode' > tmp'
17+
'..\src\iconv -f 'fromcode' -t 'tocode'//TRANSLIT < 'srcdir'\'file'.'fromcode' > tmp'
1818
'cmp 'srcdir'\'file'.'tocode' tmp'
1919
'rm -f tmp'
2020
EXIT

0 commit comments

Comments
 (0)