ICU-1220 make the -f and -t arguments optional,

and use the default encoding if they're not specified (I am split
on this between the default encoding and UTF-8). This allows one
to quickly use transliterators without having to pass these options.

X-SVN-Rev: 7693
This commit is contained in:
Yves Arrouye 2002-02-16 09:15:06 +00:00
parent 82f8f74b97
commit 0c98108e83
3 changed files with 16 additions and 17 deletions

View file

@ -1,6 +1,6 @@
// -*- Coding: utf-8; -*- [all uconv resource files]
// Copyright (c) 2000 IBM, Inc. and Others.
// $Revision: 1.23 $
// $Revision: 1.24 $
//
// Root translation file for uconv messages.
// So you want to translate this file??? Great!
@ -28,7 +28,7 @@ root
lcUsageWord { "usage" }
ucUsageWord { "Usage" }
usage { "{0}: {1} [ -h, -?, --help ] [ -V, --version ] [ -s, --silent ] [ -v, --verbose ] [ -l, --list | --list-code code | --default-code | -L, --list-transliterators ] [ --canon ] [ -x transliterator ] [ --to-callback callback | -c ] [ --from-callback callback | -i ] [ --callback callback ] [ --fallback | --no-fallback ] [ -b, --block-size size ] -f, --from-code code -t, --to-code code [ file ... ] [ -o, --output file ]\n" }
usage { "{0}: {1} [ -h, -?, --help ] [ -V, --version ] [ -s, --silent ] [ -v, --verbose ] [ -l, --list | --list-code code | --default-code | -L, --list-transliterators ] [ --canon ] [ -x transliterator ] [ --to-callback callback | -c ] [ --from-callback callback | -i ] [ --callback callback ] [ --fallback | --no-fallback ] [ -b, --block-size size ] [ -f, --from-code code ] [ -t, --to-code code ] [ file ... ] [ -o, --output file ]\n" }
help { "Options: -h, --help print this message\n"
" -V, --version print the program version\n"

View file

@ -60,8 +60,12 @@
[
.BI "\-b\fP, \fB\-\-block\-size" " size"
]
[
.BI "\-f\fP, \fB\-\-from\-code" " encoding"
]
[
.BI "\-t\fP, \fB\-\-to\-code" " encoding"
]
[
.IR file .\|.\|.
]
@ -76,9 +80,13 @@ converts, or transcodes, each given
.I file
is specified) from one
.I encoding
to another. The transcoding is done using Unicode as a pivot encoding
to another.
The transcoding is done using Unicode as a pivot encoding
(i.e. the data are first transcoded from their original encoding to
Unicode, and then from Unicode to the destination encoding).
If an
.I encoding
is not specified, the default encoding is used.
.PP
When calling
.BR uconv ,

View file

@ -885,22 +885,13 @@ int main(int argc, char **argv)
return printTransliterators(pname, printCanon) ? 3 : 0;
}
if (fromcpage == 0 && tocpage == 0) {
usage(pname, 1);
if (!fromcpage) {
fromcpage = ucnv_getDefaultName();
}
if (!tocpage) {
tocpage = ucnv_getDefaultName();
}
if (fromcpage == 0) {
initMsg(pname);
u_wmsg("noFromCodeset");
//"No conversion from codeset given (use -f)\n");
goto error_exit;
}
if (tocpage == 0) {
initMsg(pname);
u_wmsg("noToCodeset");
// "No conversion to codeset given (use -t)\n");
goto error_exit;
}
// Open the correct output file or connect to stdout for reading input
if (outfilestr != 0 && strcmp(outfilestr, "-")) {
outfile = fopen(outfilestr, "wb");