From 3696935c5205b7c1aaeb0f6f2efcdda85bc6bf44 Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Thu, 28 Feb 2019 19:20:30 -0500 Subject: cleanup --- src/nonstd/__libc_start.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/nonstd/__libc_start.c b/src/nonstd/__libc_start.c index c1cf7803..550eae6b 100644 --- a/src/nonstd/__libc_start.c +++ b/src/nonstd/__libc_start.c @@ -1,17 +1,21 @@ +#include "stdlib.h" #include "stdio.h" #include "locale.h" #include "nonstd/io.h" #ifdef _POSIX_SOURCE +#define DEFAULT_LOCALE "POSIX" #include "unistd.h" #else +#define DEFAULT_LOCALE "C" #include "nonstd/syscall.h" #define isatty(fd) __syscall(__lookup("tty"), fd) #endif void __libc_start(int argc, char **argv) { + extern int main(int, char*[]); struct __FILE *files = __libc(FILE_STREAMS); stdin = files + 0; @@ -35,14 +39,8 @@ void __libc_start(int argc, char **argv) stdout->prev = stdin; stderr->prev = stdout; - #if defined _POSIX_SOURCE - setlocale(LC_ALL, "POSIX"); - #else - setlocale(LC_ALL, "C"); - #endif + setlocale(LC_ALL, DEFAULT_LOCALE); - extern void exit(int); - extern int main(int, char*[]); exit(main(argc, argv)); } -- cgit v1.2.1