* libc/locale/locale.c (DEFAULT_LOCALE): New define.
(__default_locale): New global variable set to the default locale. (__get_locale_env): Return __default_locale rather than fixed "C".
This commit is contained in:
		| @@ -1,3 +1,9 @@ | |||||||
|  | 2009-10-09  Corinna Vinschen  <corinna@vinschen.de> | ||||||
|  |  | ||||||
|  | 	* libc/locale/locale.c (DEFAULT_LOCALE): New define. | ||||||
|  | 	(__default_locale): New global variable set to the default locale. | ||||||
|  | 	(__get_locale_env): Return __default_locale rather than fixed "C". | ||||||
|  |  | ||||||
| 2009-10-08  Jeff Johnston  <jjohnstn@redhat.com> | 2009-10-08  Jeff Johnston  <jjohnstn@redhat.com> | ||||||
|  |  | ||||||
| 	* configure.host: For RTEMS, define HAVE_ASSERT_FUNC. | 	* configure.host: For RTEMS, define HAVE_ASSERT_FUNC. | ||||||
|   | |||||||
| @@ -204,6 +204,18 @@ static char *categories[_LC_LAST] = { | |||||||
|   "LC_MESSAGES", |   "LC_MESSAGES", | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * Default locale per POSIX.  Can be overridden on a per-target base. | ||||||
|  |  */ | ||||||
|  | #ifndef DEFAULT_LOCALE | ||||||
|  | #define DEFAULT_LOCALE	"C" | ||||||
|  | #endif | ||||||
|  | /* | ||||||
|  |  * This variable can be changed by any outside mechanism.  This allows, | ||||||
|  |  * for instance, to load the default locale from a file. | ||||||
|  |  */ | ||||||
|  | char __default_locale[ENCODING_LEN + 1] = DEFAULT_LOCALE; | ||||||
|  |  | ||||||
| /* | /* | ||||||
|  * Current locales for each category |  * Current locales for each category | ||||||
|  */ |  */ | ||||||
| @@ -731,9 +743,9 @@ __get_locale_env(struct _reent *p, int category) | |||||||
|   if (env == NULL || !*env) |   if (env == NULL || !*env) | ||||||
|     env = _getenv_r (p, "LANG"); |     env = _getenv_r (p, "LANG"); | ||||||
|  |  | ||||||
|   /* 4. if none is set, fall to "C" */ |   /* 4. if none is set, fall to default locale */ | ||||||
|   if (env == NULL || !*env) |   if (env == NULL || !*env) | ||||||
|     env = "C"; |     env = __default_locale; | ||||||
|  |  | ||||||
|   return env; |   return env; | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user