diff options
author | wollman <wollman@FreeBSD.org> | 1995-08-04 18:43:01 +0000 |
---|---|---|
committer | wollman <wollman@FreeBSD.org> | 1995-08-04 18:43:01 +0000 |
commit | 99cef2aaa79c69732233a84462345b30bef389fc (patch) | |
tree | 8641f513c554873ed1c7b7aaa44b82a99dd1fe16 /lib/libc/locale | |
parent | 98a78b7aa4b5b9f0897522f5c0d101215abb82a0 (diff) | |
download | FreeBSD-src-99cef2aaa79c69732233a84462345b30bef389fc.zip FreeBSD-src-99cef2aaa79c69732233a84462345b30bef389fc.tar.gz |
Implement locale-sensitive strftime () from ADO (heavily modified
by me). This probably loses for multibyte characters, but I have no
way of telling. I'll let ache decide whether to add this support to
startup_setlocale. Note that for this to make any sense at all, the
symlinks in /usr/share/locale must go. (For the moment, this doesn't
make any difference since there are no locales supplied.)
Obtained from: Arthur David Olson <ado@elsie.nci.nih.gov>
Diffstat (limited to 'lib/libc/locale')
-rw-r--r-- | lib/libc/locale/setlocale.3 | 7 | ||||
-rw-r--r-- | lib/libc/locale/setlocale.c | 9 |
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); } } |