forked from gtkwave/gtkwave
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wave_locale.h
45 lines (41 loc) · 945 Bytes
/
wave_locale.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#ifndef __WAVE_LOCALE_H__
#define __WAVE_LOCALE_H__
#include "config.h"
#ifdef __MINGW32__
#include "locale.h"
#define WAVE_LOCALE_FIX {setlocale(LC_ALL, "C"); }
#else
#if defined HAVE_SETENV && defined HAVE_UNSETENV
#define WAVE_LOCALE_FIX \
{ \
char *wlve = getenv("LANG"); \
if(wlve) \
{ \
if(strcmp(wlve, "C")) \
{ \
setenv("LC_NUMERIC", "C", 1); \
setenv("LC_COLLATE", "C", 1); \
setenv("LC_CTYPE", "C", 1); \
} \
} \
wlve = getenv("LC_ALL"); \
if(wlve) \
{ \
if(strcmp(wlve, "C")) \
{ \
unsetenv("LC_ALL"); \
} \
} \
}
#else
#define WAVE_LOCALE_FIX \
{ \
putenv(strdup("LANG=C")); \
putenv(strdup("LC_NUMERIC=C")); \
putenv(strdup("LC_COLLATE=C")); \
putenv(strdup("LC_CTYPE=C")); \
putenv(strdup("LC_ALL=C")); \
}
#endif
#endif
#endif /* __WAVE_LOCALE_H__*/