Does awk really need to set and reset LC_NUMERIC? Does it need to set locale at all?
Jan Index: main.c =================================================================== RCS file: /cvs/src/usr.bin/awk/main.c,v retrieving revision 1.19 diff -u -p -r1.19 main.c --- main.c 22 Oct 2015 04:08:17 -0000 1.19 +++ main.c 26 Jul 2017 20:15:48 -0000 @@ -28,7 +28,6 @@ const char *version = "version 20110810" #define DEBUG #include <stdio.h> #include <ctype.h> -#include <locale.h> #include <stdlib.h> #include <string.h> #include <signal.h> @@ -61,9 +60,6 @@ int main(int argc, char *argv[]) { const char *fs = NULL; - setlocale(LC_ALL, ""); - setlocale(LC_NUMERIC, "C"); /* for parsing cmdline & prog */ - if (pledge("stdio rpath wpath cpath proc exec", NULL) == -1) { fprintf(stderr, "%s: pledge: incorrect arguments\n", cmdname); @@ -185,7 +181,6 @@ int main(int argc, char *argv[]) if (!safe) envinit(environ); yyparse(); - setlocale(LC_NUMERIC, ""); /* back to whatever it is locally */ if (fs) *FS = qstring(fs, '\0'); dprintf( ("errorflag=%d\n", errorflag) );