From d24015235c9d3410f14935dd5e8861922ca45dbd Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Sun, 17 Jan 2010 14:41:58 +0000 Subject: [PATCH] * libc/locale/locale.c (loadlocale): Allow three character language codes to accommodate ISO 639-2 codes. --- newlib/ChangeLog | 5 +++++ newlib/libc/locale/locale.c | 9 +++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/newlib/ChangeLog b/newlib/ChangeLog index 1df8968d3..1697e7490 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,8 @@ +2010-01-17 Corinna Vinschen + + * libc/locale/locale.c (loadlocale): Allow three character + language codes to accommodate ISO 639-2 codes. + 2010-01-17 Corinna Vinschen * libc/locale/locale.c (lc_ctype_charset): Disable defaulting to diff --git a/newlib/libc/locale/locale.c b/newlib/libc/locale/locale.c index 8a74034d0..8eb943094 100644 --- a/newlib/libc/locale/locale.c +++ b/newlib/libc/locale/locale.c @@ -51,8 +51,10 @@ the form language[_TERRITORY][.charset][@@modifier] -<<"language">> is a two character string per ISO 639. <<"TERRITORY">> is a -country code per ISO 3166. For <<"charset">> and <<"modifier">> see below. +<<"language">> is a two character string per ISO 639, or, if not available +for a given language, a three character string per ISO 639-2. +<<"TERRITORY">> is a country code per ISO 3166. For <<"charset">> and +<<"modifier">> see below. Additionally to the POSIX specifier, seven extensions are supported for backward compatibility with older implementations using newlib: @@ -473,6 +475,9 @@ loadlocale(struct _reent *p, int category) || c[1] < 'a' || c[1] > 'z') return NULL; c += 2; + /* Allow three character Language per ISO 639-2 */ + if (c[0] >= 'a' && c[0] <= 'z') + ++c; if (c[0] == '_') { /* Territory */