+2005-10-09 Bruno Haible <bruno@clisp.org>
+2002-07-24 Ulrich Drepper <drepper@redhat.com>
+
+ * 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 <bruno@clisp.org>
2002-07-24 Ulrich Drepper <drepper@redhat.com>
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;
*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);
/* 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] == '.')
{
/* 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
}
/* 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);