diff options
author | Carmelo Amoroso <carmelo.amoroso@st.com> | 2008-05-19 15:24:14 +0000 |
---|---|---|
committer | Carmelo Amoroso <carmelo.amoroso@st.com> | 2008-05-19 15:24:14 +0000 |
commit | 498822b67f68710b11d64a5aaf66aa1b865ef86e (patch) | |
tree | 1168f9e34f60132c697c77f315dc4d8c70081d71 | |
parent | 896ed43166010debef7661d05b1172d92a0b3064 (diff) |
Added a bounch of locale fixes.
* extra/locale/gen_wc8bit.c: use strrchr to parse locale
name to handle the case in which it contains a '.' character
like ANSI_X3.4-1968
* include/locale.h: use __UCLIBC_HAS_XLOCALE__ to control
inclusion of xlocale.h only
* libc/misc/ctype/ctype.c: add missing weak_alias for
__tolower_l and __toupper_l
* libc/misc/locale/locale.c: use strcasecmp (case insensitive)
for utf-8 locale name.
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
-rw-r--r-- | extra/locale/gen_wc8bit.c | 2 | ||||
-rw-r--r-- | include/locale.h | 4 | ||||
-rw-r--r-- | libc/misc/ctype/ctype.c | 2 | ||||
-rw-r--r-- | libc/misc/locale/locale.c | 2 |
4 files changed, 7 insertions, 3 deletions
diff --git a/extra/locale/gen_wc8bit.c b/extra/locale/gen_wc8bit.c index 429421616..7cefb53be 100644 --- a/extra/locale/gen_wc8bit.c +++ b/extra/locale/gen_wc8bit.c @@ -189,7 +189,7 @@ int main(int argc, char **argv) } else { ++s0; } - s1 = strchr(s0, '.'); + s1 = strrchr(s0, '.'); if (!s1) { n = strlen(s0); } else { diff --git a/include/locale.h b/include/locale.h index 02d33a0d4..ba04e8902 100644 --- a/include/locale.h +++ b/include/locale.h @@ -132,7 +132,7 @@ extern struct lconv *localeconv (void) __THROW; __END_NAMESPACE_STD -#if defined(__USE_GNU) && defined(__UCLIBC_HAS_XLOCALE__) +#if defined(__USE_GNU) /* The concept of one static locale per category is not very well thought out. Many applications will need to process its data using information from several different locales. Another application is @@ -144,8 +144,10 @@ __END_NAMESPACE_STD Attention: all these functions are *not* standardized in any form. This is a proof-of-concept implementation. */ +#if defined(__UCLIBC_HAS_XLOCALE__) /* Get locale datatype definition. */ # include <xlocale.h> +#endif typedef __locale_t locale_t; diff --git a/libc/misc/ctype/ctype.c b/libc/misc/ctype/ctype.c index d88b342fd..76a671a44 100644 --- a/libc/misc/ctype/ctype.c +++ b/libc/misc/ctype/ctype.c @@ -316,6 +316,7 @@ int tolower_l(int c, __locale_t l) return __UCLIBC_CTYPE_IN_TO_DOMAIN(c) ? l->__ctype_tolower[c] : c; } libc_hidden_def(tolower_l) +weak_alias (tolower_l, __tolower_l) #endif /**********************************************************************/ @@ -362,6 +363,7 @@ int toupper_l(int c, __locale_t l) return __UCLIBC_CTYPE_IN_TO_DOMAIN(c) ? l->__ctype_toupper[c] : c; } libc_hidden_def(toupper_l) +weak_alias (toupper_l, __toupper_l) #endif /**********************************************************************/ diff --git a/libc/misc/locale/locale.c b/libc/misc/locale/locale.c index b782d5ead..67ca4c248 100644 --- a/libc/misc/locale/locale.c +++ b/libc/misc/locale/locale.c @@ -1142,7 +1142,7 @@ static int find_locale(int category_mask, const char *p, /* TODO: maybe CODESET_LIST + *s ??? */ /* 7bit is 1, UTF-8 is 2, 8-bit is >= 3 */ codeset = 2; - if (strcmp(utf8,p+6) != 0) {/* TODO - fix! */ + if (strcasecmp(utf8,p+6) != 0) {/* TODO - fix! */ s = CODESET_LIST; do { ++codeset; /* Increment codeset first. */ |