From 7ef8a7379f7f7d09e71ccae2a0b688c3cd80423f Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Fri, 8 Feb 2019 18:42:39 -0500 Subject: merge sources into single tree --- src/nonstd/__libc.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 src/nonstd/__libc.c (limited to 'src/nonstd/__libc.c') diff --git a/src/nonstd/__libc.c b/src/nonstd/__libc.c new file mode 100644 index 00000000..2d246203 --- /dev/null +++ b/src/nonstd/__libc.c @@ -0,0 +1,44 @@ +#include +#include "locale.h" +#include "nonstd/locale.h" + +#include "_printf.h" +#include "_syscall.h" + +void *__libc(LIBC_INTERNAL variable) +{ + extern void *__libc_per_thread(LIBC_INTERNAL __variable); + + void *r = (void*)0; + + static struct __locale_t locale; + + switch (variable) { + case ERRNO: + return __libc_per_thread(ERRNO); + + case THREAD_LOCALE: + r = __libc_per_thread(THREAD_LOCALE); + if (r) { + break; + } + /* fallthru */ + + case GLOBAL_LOCALE: + r = &locale; + break; + + case SYSCALL_LOOKUP: + r = (void*)__syscall_lookup; + break; + + case PRINTF: + r = (void*)(__printf); + break; + + default: + break; + } + + return r; +} -- cgit v1.2.1