summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2019-02-28 19:20:55 -0500
committerJakob Kaivo <jkk@ung.org>2019-02-28 19:20:55 -0500
commit60d7e30cbc0a195c708616a3e2ce73a0e600c561 (patch)
treedb5b8969eb3cf6e2423e7060636610ff77afd6b9 /src
parent3696935c5205b7c1aaeb0f6f2efcdda85bc6bf44 (diff)
add locale stuff
Diffstat (limited to 'src')
-rw-r--r--src/nonstd/__libc.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/src/nonstd/__libc.c b/src/nonstd/__libc.c
index 354dee9b..f596a3c8 100644
--- a/src/nonstd/__libc.c
+++ b/src/nonstd/__libc.c
@@ -32,11 +32,35 @@ void *__libc(LIBC_INTERNAL variable)
break;
case CTYPE:
- r = __libc_per_thread(THREAD_LOCALE);
- if (!r) {
+ r = __libc(THREAD_LOCALE);
+ if (((struct __locale_t*)r)->ctype[0] == '\0') {
+ r = &locale;
+ }
+ r = ((struct __locale_t*)r)->lc_ctype.ctattr;
+ break;
+
+ case TOLOWER:
+ r = __libc(THREAD_LOCALE);
+ if (((struct __locale_t*)r)->ctype[0] == '\0') {
+ r = &locale;
+ }
+ r = ((struct __locale_t*)r)->lc_ctype.ctolower;
+ break;
+
+ case TOUPPER:
+ r = __libc(THREAD_LOCALE);
+ if (((struct __locale_t*)r)->ctype[0] == '\0') {
+ r = &locale;
+ }
+ r = ((struct __locale_t*)r)->lc_ctype.ctoupper;
+ break;
+
+ case LCONV:
+ r = __libc(THREAD_LOCALE);
+ if (((struct __locale_t*)r)->numeric[0] == '\0') {
r = &locale;
}
- r = ((struct __locale_t*)r)->ctype;
+ r = &(((struct __locale_t*)r)->mn);
break;
case SYSCALL_LOOKUP: