summaryrefslogtreecommitdiff
path: root/locale.c
diff options
context:
space:
mode:
authorChet Ramey <chet.ramey@case.edu>2011-12-03 13:33:56 -0500
committerChet Ramey <chet.ramey@case.edu>2011-12-03 13:33:56 -0500
commit898cc92e1b58f706269e97aa7b148ca55583c4c1 (patch)
treed88d1205d8e7b13a2f0a91c995b4ca36d2cfa6d1 /locale.c
parente6e3b4442080b63cf18d1428138434900a8ea128 (diff)
downloadbash-898cc92e1b58f706269e97aa7b148ca55583c4c1.tar.gz
commit bash-20040729 snapshot
Diffstat (limited to 'locale.c')
-rw-r--r--locale.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/locale.c b/locale.c
index 0c4772a9..48e44ec4 100644
--- a/locale.c
+++ b/locale.c
@@ -71,8 +71,8 @@ set_default_locale ()
textdomain (PACKAGE);
}
-/* Set default values for LC_CTYPE, LC_COLLATE, LC_MESSAGES and LC_NUMERIC
- if they are not specified in the environment, but LC_ALL is. This
+/* Set default values for LC_CTYPE, LC_COLLATE, LC_MESSAGES, LC_NUMERIC and
+ LC_TIME if they are not specified in the environment, but LC_ALL is. This
should be called from main() after parsing the environment. */
void
set_default_locale_vars ()
@@ -109,6 +109,12 @@ set_default_locale_vars ()
setlocale (LC_NUMERIC, lc_all);
# endif /* LC_NUMERIC */
+# if defined (LC_TIME)
+ val = get_string_value ("LC_TIME");
+ if (val == 0 && lc_all && *lc_all)
+ setlocale (LC_TIME, lc_all);
+# endif /* LC_TIME */
+
#endif /* HAVE_SETLOCALE */
val = get_string_value ("TEXTDOMAIN");
@@ -213,7 +219,15 @@ set_locale_var (var, value)
return (setlocale (LC_NUMERIC, get_locale_var ("LC_NUMERIC")) != 0);
# endif /* LC_NUMERIC */
}
+ else if (var[3] == 'T' && var[4] == 'I') /* LC_TIME */
+ {
+# if defined (LC_TIME)
+ if (lc_all == 0 || *lc_all == '\0')
+ return (setlocale (LC_TIME, get_locale_var ("LC_TIME")) != 0);
+# endif /* LC_TIME */
+ }
#endif /* HAVE_SETLOCALE */
+
return (0);
}
@@ -285,6 +299,9 @@ reset_locale_vars ()
# if defined (LC_NUMERIC)
setlocale (LC_NUMERIC, get_locale_var ("LC_NUMERIC"));
# endif
+# if defined (LC_TIME)
+ setlocale (LC_TIME, get_locale_var ("LC_TIME"));
+# endif
locale_setblanks ();