From: Bruno Haible Date: Wed, 19 Oct 2005 10:58:29 +0000 (+0000) Subject: Recognize the full POSIX locale name syntax. X-Git-Tag: v0.15~360 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=091f7f4651a2adc5a09f6f66149ce468b2b17795;p=thirdparty%2Fgettext.git Recognize the full POSIX locale name syntax. --- diff --git a/gettext-runtime/intl/ChangeLog b/gettext-runtime/intl/ChangeLog index 56b6f2d10..99a799833 100644 --- a/gettext-runtime/intl/ChangeLog +++ b/gettext-runtime/intl/ChangeLog @@ -1,3 +1,14 @@ +2005-10-09 Bruno Haible +2002-07-24 Ulrich Drepper + + * explodename.c: Recognize the syntax + language[_territory][.codeset][@modifier] + instead of only + language[_territory[.codeset]][@modifier] + (_nl_find_language): Accept '.' as terminator. + (_nl_explode_name): Accept to parse a codeset without a territory. + Accept an underscore in the territory. + 2005-10-09 Bruno Haible 2002-07-24 Ulrich Drepper diff --git a/gettext-runtime/intl/explodename.c b/gettext-runtime/intl/explodename.c index a55e74d93..04f82bd44 100644 --- a/gettext-runtime/intl/explodename.c +++ b/gettext-runtime/intl/explodename.c @@ -45,7 +45,7 @@ static char *_nl_find_language (const char *name); static char * _nl_find_language (const char *name) { - while (name[0] != '\0' && name[0] != '_' && name[0] != '@') + while (name[0] != '\0' && name[0] != '_' && name[0] != '@' && name[0] != '.') ++name; return (char *) name; @@ -67,7 +67,7 @@ _nl_explode_name (char *name, *normalized_codeset = NULL; /* Now we determine the single parts of the locale name. First - look for the language. Termination symbols are `_' and `@'. */ + look for the language. Termination symbols are `_', '.', and `@'. */ mask = 0; *language = cp = name; cp = _nl_find_language (*language); @@ -76,16 +76,19 @@ _nl_explode_name (char *name, /* This does not make sense: language has to be specified. Use this entry as it is without exploding. Perhaps it is an alias. */ cp = strchr (*language, '\0'); - else if (cp[0] == '_') + else { - /* Next is the territory. */ - cp[0] = '\0'; - *territory = ++cp; + if (cp[0] == '_') + { + /* Next is the territory. */ + cp[0] = '\0'; + *territory = ++cp; - while (cp[0] != '\0' && cp[0] != '.' && cp[0] != '@' && cp[0] != '_') - ++cp; + while (cp[0] != '\0' && cp[0] != '.' && cp[0] != '@') + ++cp; - mask |= XPG_TERRITORY; + mask |= XPG_TERRITORY; + } if (cp[0] == '.') { diff --git a/gettext-runtime/intl/finddomain.c b/gettext-runtime/intl/finddomain.c index 320cb1056..237fe6ef5 100644 --- a/gettext-runtime/intl/finddomain.c +++ b/gettext-runtime/intl/finddomain.c @@ -68,7 +68,7 @@ _nl_find_domain (const char *dirname, char *locale, /* LOCALE can consist of up to four recognized parts for the XPG syntax: - language[_territory[.codeset]][@modifier] + language[_territory][.codeset][@modifier] Beside the first part all of them are allowed to be missing. If the full specified locale is not found, the less specific one are @@ -137,7 +137,7 @@ _nl_find_domain (const char *dirname, char *locale, } /* Now we determine the single parts of the locale name. First - look for the language. Termination symbols are `_' and `@'. */ + look for the language. Termination symbols are `_', '.', and `@'. */ mask = _nl_explode_name (locale, &language, &modifier, &territory, &codeset, &normalized_codeset);