1 #include <msvcrt/stdio.h>
2 #include <msvcrt/locale.h>
3 #include <msvcrt/string.h>
7 int _current_category; /* used by setlocale */
8 const char *_current_locale;
10 int parse_locale(char *locale, char *lang, char *country, char *code_page);
15 char *setlocale(int category, const char *locale)
21 parse_locale((char *)locale,lang,country,code_page);
24 //printf("%s %s %s %s\n",locale,lang,country,code_page);
51 locale "lang[_country[.code_page]]"
57 int parse_locale(char *locale, char *lang, char *country, char *code_page)
59 while ( *locale != 0 && *locale != '.' && *locale != '_' )
66 if ( *locale == '_' ) {
68 while ( *locale != 0 && *locale != '.' )
78 if ( *locale == '.' ) {
80 while ( *locale != 0 && *locale != '.' )
92 const struct map_lcid2str {
97 {0x0409,"English", "United States"},
98 {0x0809,"English", "United Kingdom"},
99 {0x0000,"Unknown", "Unknown"}
103 const struct map_cntr {
107 {"britain", "united kingdom"},
108 {"england", "united kingdom"},
109 {"gbr", "united kingdom"},
110 {"great britain", "united kingdom"},
111 {"uk", "united kingdom"},
112 {"united kingdom", "united kingdom"},
113 {"united-kingdom", "united kingdom"},
114 {"america", "united states" },
115 {"united states", "united states"},
116 {"united-states", "united states"},
117 {"us", "united states"},
118 {"usa" "united states"}
122 struct lconv _lconv = {
123 ".", // decimal_point
124 ",", // thousands_sep
126 "DOL", // int_curr_symbol
127 "$", // currency_symbol
128 ".", // mon_decimal_point
129 ",", // mon_thousands_sep
131 "+", // positive_sign
132 "-", // negative_sign
133 127, // int_frac_digits
135 127, // p_cs_precedes
136 127, // p_sep_by_space
137 127, // n_cs_precedes
138 127, // n_sep_by_space
146 struct lconv *localeconv(void)
148 return (struct lconv *) &_lconv;