aboutsummaryrefslogtreecommitdiff
path: root/iconv/iconv_open.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-01-22 13:02:12 +0000
committerUlrich Drepper <drepper@redhat.com>1999-01-22 13:02:12 +0000
commitbd4848fb22d5125ef9717b152097d26c855682f4 (patch)
treea2baee82a2a8726a3e5ca16fd1b35cd26c0fd372 /iconv/iconv_open.c
parente18db2b0eec02e478cfaaed5a7ac71bef4fccc6a (diff)
downloadglibc-bd4848fb22d5125ef9717b152097d26c855682f4.zip
glibc-bd4848fb22d5125ef9717b152097d26c855682f4.tar.gz
glibc-bd4848fb22d5125ef9717b152097d26c855682f4.tar.bz2
Update.
1999-01-22 Ulrich Drepper <drepper@cygnus.com> * iconv/gconv_conf.c (add_alias): Convert names to uppercase before adding into search tree. (add_module): Likewise. * iconv/iconv_open.c: Likewise. * iconv/gconv_db.c: Change all __strcasecmp to strcmp. * iconv/skeleton.c (gconv_init): Likewise.
Diffstat (limited to 'iconv/iconv_open.c')
-rw-r--r--iconv/iconv_open.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/iconv/iconv_open.c b/iconv/iconv_open.c
index cad8be6..49576fd 100644
--- a/iconv/iconv_open.c
+++ b/iconv/iconv_open.c
@@ -1,5 +1,5 @@
/* Get descriptor for character set conversion.
- Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -35,7 +35,7 @@ strip (char *wp, const char *s)
while (*s != '\0')
{
if (isalnum (*s) || *s == '_' || *s == '-' || *s == '.')
- *wp++ = *s;
+ *wp++ = toupper (*s);
else if (*s == '/')
{
if (++slash_count == 3)
@@ -52,6 +52,16 @@ strip (char *wp, const char *s)
}
+static char *
+upstr (char *str)
+{
+ char *cp = str;
+ while ((*cp = toupper (*cp)) != '\0')
+ ++cp;
+ return str;
+}
+
+
iconv_t
iconv_open (const char *tocode, const char *fromcode)
{
@@ -67,14 +77,14 @@ iconv_open (const char *tocode, const char *fromcode)
tocode_len = strlen (tocode);
tocode_conv = alloca (tocode_len + 3);
strip (tocode_conv, tocode);
+ tocode = tocode_conv[2] == '\0' ? upstr (tocode) : tocode_conv;
fromcode_len = strlen (fromcode);
fromcode_conv = alloca (fromcode_len + 3);
strip (fromcode_conv, fromcode);
+ fromcode = romcode_conv[2] == '\0' ? upstr (fromcode) : fromcode_conv;
- res = __gconv_open (tocode_conv[2] == '\0' ? tocode : tocode_conv,
- fromcode_conv[2] == '\0' ? fromcode : fromcode_conv,
- &cd);
+ res = __gconv_open (tocode, fromcode, &cd);
if (res != GCONV_OK)
{