Changeset View
Changeset View
Standalone View
Standalone View
lib/libc/locale/xlocale.c
Context not available. | |||||
if (new->components[type]) { | if (new->components[type]) { | ||||
strncpy(new->components[type]->locale, src->locale, | strncpy(new->components[type]->locale, src->locale, | ||||
ENCODING_LEN); | ENCODING_LEN); | ||||
strncpy(new->components[type]->version, src->version, | |||||
XLOCALE_VERSION_LEN); | |||||
} | } | ||||
} else if (base->components[type]) { | } else if (base->components[type]) { | ||||
new->components[type] = xlocale_retain(base->components[type]); | new->components[type] = xlocale_retain(base->components[type]); | ||||
Context not available. | |||||
} | } | ||||
/* | /* | ||||
* Returns the name of the locale for a particular component of a locale_t. | * Returns the name or version of the locale for a particular component of a | ||||
* locale_t. | |||||
*/ | */ | ||||
const char *querylocale(int mask, locale_t loc) | const char *querylocale(int mask, locale_t loc) | ||||
{ | { | ||||
int type = ffs(mask) - 1; | int type = ffs(mask & ~LC_VERSION_MASK) - 1; | ||||
FIX_LOCALE(loc); | FIX_LOCALE(loc); | ||||
if (type >= XLC_LAST) | if (type >= XLC_LAST) | ||||
return (NULL); | return (NULL); | ||||
if (loc->components[type]) | if (mask & LC_VERSION_MASK) { | ||||
return (loc->components[type]->locale); | if (loc->components[type]) | ||||
return ("C"); | return (loc->components[type]->version); | ||||
return (""); | |||||
} else { | |||||
if (loc->components[type]) | |||||
return (loc->components[type]->locale); | |||||
return ("C"); | |||||
} | |||||
} | } | ||||
/* | /* | ||||
Context not available. |