diff options
author | Jakob Kaivo <jkk@ung.org> | 2019-01-29 20:46:42 -0500 |
---|---|---|
committer | Jakob Kaivo <jkk@ung.org> | 2019-01-29 20:46:42 -0500 |
commit | 77f35b75bf7c3f7810d04eecc7095b141c8755ed (patch) | |
tree | 20d9c556a440af70ba8381130c98215ec5da8b6d /nonstd | |
parent | be00cdda076b81204aa62ccca55f8d2dc3474af9 (diff) |
initialize locale prior to entering main()
Diffstat (limited to 'nonstd')
-rw-r--r-- | nonstd/libc.c | 9 |
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)); } |