From 208ad2d53d09926f2adf60ba930393ad4a5fd0cf Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Wed, 27 Feb 2019 21:22:43 -0500 Subject: initialize stdio and locale --- src/nonstd/__libc_start.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/nonstd/__libc_start.c b/src/nonstd/__libc_start.c index 0cff0ab3..e10e081e 100644 --- a/src/nonstd/__libc_start.c +++ b/src/nonstd/__libc_start.c @@ -1,23 +1,27 @@ +#include "stdio.h" +#include "locale.h" + +#include "nonstd/io.h" + void __libc_start(int argc, char **argv) { - /* - struct __fopen_options fo = {0}; + struct __FILE sin, sout, serr; - fo.fd = 0; - stdin = __libc.stdio.fopen(&fo); + sin.fd = 0; + stdin = &sin; - fo.fd = 1; - stdout = __libc.stdio.fopen(&fo); + sout.fd = 1; + stdout = &sout; - fo.fd = 2; - stderr = __libc.stdio.fopen(&fo); + serr.fd = 2; + stderr = &serr; - #if defined _POSIX_SOURCE || defined _POSIX_C_SOURCE || defined _XOPEN_SOURCE + #if defined _POSIX_SOURCE setlocale(LC_ALL, "POSIX"); #else setlocale(LC_ALL, "C"); #endif - */ + extern void exit(int); extern int main(int, char*[]); -- cgit v1.2.1