From c631824a8ec1b453e485813c36850ad87372254b Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Sat, 23 Jan 2010 14:32:25 +0000 Subject: [PATCH] * libc/locale/locale.c (loadlocale): Disable JIS entirely on Cygwin. Allow TIS620 and TIS-620 as aliases for CP874 on Cygwin. --- newlib/ChangeLog | 5 +++++ newlib/libc/locale/locale.c | 15 ++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/newlib/ChangeLog b/newlib/ChangeLog index 396d0c3ee..6b482e547 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,8 @@ +2010-01-23 Corinna Vinschen + + * libc/locale/locale.c (loadlocale): Disable JIS entirely on Cygwin. + Allow TIS620 and TIS-620 as aliases for CP874 on Cygwin. + 2010-01-22 Corinna Vinschen * libc/locale/lmonetary.c (__monetary_load_locale): Take additional diff --git a/newlib/libc/locale/locale.c b/newlib/libc/locale/locale.c index 4dd773463..1cbfa4074 100644 --- a/newlib/libc/locale/locale.c +++ b/newlib/libc/locale/locale.c @@ -83,7 +83,7 @@ dash, <<"EUC-JP">> and <<"EUC-KR">>. corresponding LC_* environment variables and $LANG according to POSIX rules. Under Cygwin, this implementation additionally supports the charsets -<<"GBK">>, <<"eucKR">>, and <<"Big5">>. +<<"GBK">>, <<"eucKR">>, <<"Big5">>, and <<"TIS-620">>. This implementation also supports a single modifier, <<"cjknarrow">>. Any other modifier is ignored. <<"cjknarrow">>, in conjunction with one @@ -547,6 +547,7 @@ loadlocale(struct _reent *p, int category) l_mbtowc = __utf8_mbtowc; #endif break; +#ifndef __CYGWIN__ case 'J': case 'j': if (strcasecmp (charset, "JIS")) @@ -558,6 +559,7 @@ loadlocale(struct _reent *p, int category) l_mbtowc = __jis_mbtowc; #endif break; +#endif case 'E': case 'e': if (!strcasecmp (charset, "EUCJP") || !strcasecmp (charset, "EUC-JP")) @@ -714,6 +716,17 @@ loadlocale(struct _reent *p, int category) #ifdef _MB_CAPABLE l_wctomb = __big5_wctomb; l_mbtowc = __big5_mbtowc; +#endif + break; + case 'T': + case 't': + if (strcasecmp (charset, "TIS620") && strcasecmp (charset, "TIS-620")) + return NULL; + strcpy (charset, "CP874"); + mbc_max = 1; +#ifdef _MB_CAPABLE + l_wctomb = __cp_wctomb; + l_mbtowc = __cp_mbtowc; #endif break; #endif /* __CYGWIN__ */ -- 2.43.5