summaryrefslogtreecommitdiffstats
path: root/SOURCES/bash-4.0-setlocale.dif
diff options
context:
space:
mode:
Diffstat (limited to 'SOURCES/bash-4.0-setlocale.dif')
-rw-r--r--SOURCES/bash-4.0-setlocale.dif39
1 files changed, 39 insertions, 0 deletions
diff --git a/SOURCES/bash-4.0-setlocale.dif b/SOURCES/bash-4.0-setlocale.dif
new file mode 100644
index 0000000..cec7bc1
--- /dev/null
+++ b/SOURCES/bash-4.0-setlocale.dif
@@ -0,0 +1,39 @@
+Index: locale.c
+===================================================================
+--- locale.c.orig
++++ locale.c
+@@ -47,6 +47,7 @@ extern int dump_translatable_strings, du
+
+ /* The current locale when the program begins */
+ static char *default_locale;
++static char fallback[128];
+
+ /* The current domain for textdomain(3). */
+ static char *default_domain;
+@@ -314,11 +315,21 @@ get_locale_var (var)
+ if (locale == 0 || *locale == 0)
+ locale = lang;
+ if (locale == 0 || *locale == 0)
+-#if 0
+- locale = default_locale; /* system-dependent; not really portable. should it be "C"? */
+-#else
+- locale = "";
+-#endif
++ {
++ char *ptr;
++ if (default_locale && *default_locale && (ptr = strstr(default_locale, var)) && (ptr = strchr(ptr, '=')) && ++ptr)
++ {
++ memset (fallback, 0, sizeof(fallback));
++ strncpy(fallback, ptr, sizeof(fallback)-1);
++
++ if ((ptr = strchr(fallback, ';')))
++ *ptr = '\0';
++
++ locale = fallback;
++ }
++ else
++ locale = default_locale; /* system-dependent; not really portable. should it be "C"? */
++ }
+ return (locale);
+ }
+