From 77f35b75bf7c3f7810d04eecc7095b141c8755ed Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Tue, 29 Jan 2019 20:46:42 -0500 Subject: initialize locale prior to entering main() --- nonstd/libc.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'nonstd/libc.c') 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 +#include + #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)); } -- cgit v1.2.1