- if (loc == NULL)
- loc = __current_locale();
- else if (loc == LC_GLOBAL_LOCALE)
- loc = &__global_locale;
- for(m = 1; m <= _LC_LAST_MASK; m <<= 1) {
- if (m & mask) {
- switch(m) {
- case LC_COLLATE_MASK:
- return (loc->__collate_load_error ? C : loc->__lc_collate->__encoding);
- case LC_CTYPE_MASK:
- return loc->__lc_ctype->__ctype_encoding;
- case LC_MESSAGES_MASK:
- return (loc->_messages_using_locale ? loc->__lc_messages->_messages_locale_buf : C);
- case LC_MONETARY_MASK:
- return (loc->_monetary_using_locale ? loc->__lc_monetary->_monetary_locale_buf : C);
- case LC_NUMERIC_MASK:
- return (loc->_numeric_using_locale ? loc->__lc_numeric->_numeric_locale_buf : C);
- case LC_TIME_MASK:
- return (loc->_time_using_locale ? loc->__lc_time->_time_locale_buf : C);
- }
- }