Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2009-10-09 12:25:28 +0400
committerCorinna Vinschen <corinna@vinschen.de>2009-10-09 12:25:28 +0400
commitec4e5025e91a5012681702567d5b64627abe499e (patch)
treeb1ba831682c5b14c083b108bc8669eb03eb18040 /newlib/libc/locale
parenta3a62ae7a58879c77fe7de79533ad1024d8d4856 (diff)
* 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".
Diffstat (limited to 'newlib/libc/locale')
-rw-r--r--newlib/libc/locale/locale.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/newlib/libc/locale/locale.c b/newlib/libc/locale/locale.c
index 25b1a00d5..311a43820 100644
--- a/newlib/libc/locale/locale.c
+++ b/newlib/libc/locale/locale.c
@@ -205,6 +205,18 @@ static char *categories[_LC_LAST] = {
};
/*
+ * 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
*/
static char current_categories[_LC_LAST][ENCODING_LEN + 1] = {
@@ -731,9 +743,9 @@ __get_locale_env(struct _reent *p, int category)
if (env == NULL || !*env)
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)
- env = "C";
+ env = __default_locale;
return env;
}