summaryrefslogtreecommitdiff
path: root/nonstd
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2019-01-29 20:46:42 -0500
committerJakob Kaivo <jkk@ung.org>2019-01-29 20:46:42 -0500
commit77f35b75bf7c3f7810d04eecc7095b141c8755ed (patch)
tree20d9c556a440af70ba8381130c98215ec5da8b6d /nonstd
parentbe00cdda076b81204aa62ccca55f8d2dc3474af9 (diff)
initialize locale prior to entering main()
Diffstat (limited to 'nonstd')
-rw-r--r--nonstd/libc.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/nonstd/libc.c b/nonstd/libc.c
index 766f917f..dabbc44a 100644
--- a/nonstd/libc.c
+++ b/nonstd/libc.c
@@ -1,4 +1,6 @@
#include <stddef.h>
+#include <locale.h>
+
#include "nonstd/types.h"
#include "nonstd/public/setjmp.h"
@@ -86,6 +88,13 @@ void __libc_start(int argc, char **argv)
stdout = __libc.stdio.fopen(&fo);
fo.fd = 2;
stderr = __libc.stdio.fopen(&fo);
+
+ #if defined _POSIX_SOURCE || defined _POSIX_C_SOURCE || defined _XOPEN_SOURCE
+ setlocale("POSIX");
+ #else
+ setlocale(LC_ALL, "C");
+ #endif
+
exit(main(argc, argv));
}