From 60d7e30cbc0a195c708616a3e2ce73a0e600c561 Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Thu, 28 Feb 2019 19:20:55 -0500 Subject: add locale stuff --- src/nonstd/__libc.c | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) (limited to 'src') 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: -- cgit v1.2.1