From e4060100b5525aaa0372e09a359ea9903d6ef380 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sun, 4 Feb 2001 05:49:00 +0000 Subject: (main): If -f or -t argument is missing use charset of the current locale. --- iconv/iconv_prog.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'iconv/iconv_prog.c') diff --git a/iconv/iconv_prog.c b/iconv/iconv_prog.c index 8776192e37..3c7851f7a5 100644 --- a/iconv/iconv_prog.c +++ b/iconv/iconv_prog.c @@ -19,11 +19,13 @@ Boston, MA 02111-1307, USA. */ #include +#include #include #include #include #include #include +#include #include #include #include @@ -131,16 +133,20 @@ main (int argc, char *argv[]) print_known_names (); exit (EXIT_SUCCESS); } - - /* If either the from- or to-code is not specified this is an error - since we do not know what to do. */ - if (from_code == NULL && to_code == NULL) - error (EXIT_FAILURE, 0, - _("neither original nor target encoding specified")); if (from_code == NULL) - error (EXIT_FAILURE, 0, _("original encoding not specified using `-f'")); + { + /* The Unix standard says that in this case the charset of the current + locale is used. */ + from_code = nl_langinfo (CODESET); + assert (from_code != NULL); + } if (to_code == NULL) - error (EXIT_FAILURE, 0, _("target encoding not specified using `-t'")); + { + /* The Unix standard says that in this case the charset of the current + locale is used. */ + to_code = nl_langinfo (CODESET); + assert (to_code != NULL); + } /* If we have to ignore errors make sure we use the appropriate name for the to-character-set. */ -- cgit 1.4.1