1 #ifndef __WAVE_LOCALE_H__ 2 #define __WAVE_LOCALE_H__ 3 4 #include "config.h" 5 6 #ifdef __MINGW32__ 7 #include "locale.h" 8 #define WAVE_LOCALE_FIX {setlocale(LC_ALL, "C"); } 9 #else 10 #if HAVE_SETENV && HAVE_UNSETENV 11 #define WAVE_LOCALE_FIX \ 12 { \ 13 char *wlve = getenv("LANG"); \ 14 if(wlve) \ 15 { \ 16 if(strcmp(wlve, "C")) \ 17 { \ 18 setenv("LC_NUMERIC", "C", 1); \ 19 setenv("LC_COLLATE", "C", 1); \ 20 setenv("LC_CTYPE", "C", 1); \ 21 } \ 22 } \ 23 wlve = getenv("LC_ALL"); \ 24 if(wlve) \ 25 { \ 26 if(strcmp(wlve, "C")) \ 27 { \ 28 unsetenv("LC_ALL"); \ 29 } \ 30 } \ 31 } 32 #else 33 #define WAVE_LOCALE_FIX \ 34 { \ 35 putenv(strdup("LANG=C")); \ 36 putenv(strdup("LC_NUMERIC=C")); \ 37 putenv(strdup("LC_COLLATE=C")); \ 38 putenv(strdup("LC_CTYPE=C")); \ 39 putenv(strdup("LC_ALL=C")); \ 40 } 41 #endif 42 #endif 43 44 #endif /* __WAVE_LOCALE_H__*/ 45 46