diff options
author | Jakub Jelinek <jakub@redhat.com> | 2008-03-14 17:45:12 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2008-03-14 17:45:12 +0000 |
commit | bda3e2dbc1ece01b6f015d47c04f74e5c6037dde (patch) | |
tree | 7c10df9932eddbe88fa62865a064249fe2af60b3 /iconv/iconv_charmap.c | |
parent | b87b7fc3e6e41cf8006fb2341c236a46f6d8bdd4 (diff) | |
download | glibc-bda3e2dbc1ece01b6f015d47c04f74e5c6037dde.tar.gz glibc-bda3e2dbc1ece01b6f015d47c04f74e5c6037dde.tar.xz glibc-bda3e2dbc1ece01b6f015d47c04f74e5c6037dde.zip |
Updated to fedora-glibc-20080314T1732
Diffstat (limited to 'iconv/iconv_charmap.c')
-rw-r--r-- | iconv/iconv_charmap.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/iconv/iconv_charmap.c b/iconv/iconv_charmap.c index f679c64eb2..d128111912 100644 --- a/iconv/iconv_charmap.c +++ b/iconv/iconv_charmap.c @@ -1,5 +1,5 @@ /* Convert using charmaps and possibly iconv(). - Copyright (C) 2001, 2005, 2006 Free Software Foundation, Inc. + Copyright (C) 2001, 2005, 2006, 2008 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2001. @@ -94,7 +94,8 @@ static int process_file (struct convtable *tbl, FILE *input, FILE *output); int charmap_conversion (const char *from_code, struct charmap_t *from_charmap, const char *to_code, struct charmap_t *to_charmap, - int argc, int remaining, char *argv[], FILE *output) + int argc, int remaining, char *argv[], + const char *output_file) { struct convtable *cvtbl; int status = EXIT_SUCCESS; @@ -132,6 +133,17 @@ charmap_conversion (const char *from_code, struct charmap_t *from_charmap, if (cvtbl == NULL) return EXIT_FAILURE; + /* Determine output file. */ + FILE *output; + if (output_file != NULL && strcmp (output_file, "-") != 0) + { + output = fopen (output_file, "w"); + if (output == NULL) + error (EXIT_FAILURE, errno, _("cannot open output file")); + } + else + output = stdout; + /* We can now start the conversion. */ if (remaining == argc) { |