summaryrefslogtreecommitdiffstats
path: root/lib/libc/locale
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/locale')
-rw-r--r--lib/libc/locale/setlocale.37
-rw-r--r--lib/libc/locale/setlocale.c9
2 files changed, 14 insertions, 2 deletions
diff --git a/lib/libc/locale/setlocale.3 b/lib/libc/locale/setlocale.3
index e0068f4..f6b75b6 100644
--- a/lib/libc/locale/setlocale.3
+++ b/lib/libc/locale/setlocale.3
@@ -302,7 +302,12 @@ The current implementation supports only the
.Li "\&""C""
and
.Li "\&""POSIX""
-locales for all but the LC_CTYPE and LC_COLLATE locale.
+locales for all but the
+.Dv LC_COLLATE ,
+.Dv LC_CTYPE ,
+and
+.Dv LC_TIME
+categories.
.Pp
In spite of the gnarly currency support in
.Fn localeconv ,
diff --git a/lib/libc/locale/setlocale.c b/lib/libc/locale/setlocale.c
index 20bcb6a..8066943 100644
--- a/lib/libc/locale/setlocale.c
+++ b/lib/libc/locale/setlocale.c
@@ -166,6 +166,14 @@ loadlocale(category)
return (current_categories[LC_COLLATE]);
}
+ if (category == LC_TIME) {
+ if (__time_load_locale(new_categories[LC_TIME]) < 0)
+ return (NULL);
+ strcpy(current_categories[LC_COLLATE],
+ new_categories[LC_COLLATE]);
+ return (current_categories[LC_COLLATE]);
+ }
+
if (!strcmp(new_categories[category], "C") ||
!strcmp(new_categories[category], "POSIX")) {
@@ -188,7 +196,6 @@ loadlocale(category)
switch (category) {
case LC_MONETARY:
case LC_NUMERIC:
- case LC_TIME:
return (NULL);
}
}
OpenPOWER on IntegriCloud