summaryrefslogtreecommitdiff
path: root/src/nonstd/__libc_start.c
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2019-02-28 19:20:30 -0500
committerJakob Kaivo <jkk@ung.org>2019-02-28 19:20:30 -0500
commit3696935c5205b7c1aaeb0f6f2efcdda85bc6bf44 (patch)
tree645f8ef0ab7390b2dd2cf346126775889a708077 /src/nonstd/__libc_start.c
parent6fab6afd8960ec2ebaf93a6d5a0da25ac6b135da (diff)
cleanup
Diffstat (limited to 'src/nonstd/__libc_start.c')
-rw-r--r--src/nonstd/__libc_start.c12
1 files changed, 5 insertions, 7 deletions
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));
}