svn commit: trunk/busybox/coreutils
vda at busybox.net
vda at busybox.net
Tue Dec 12 16:35:22 PST 2006
Author: vda
Date: 2006-12-12 16:35:21 -0800 (Tue, 12 Dec 2006)
New Revision: 16866
Log:
date: -R shouldn't use locale
Modified:
trunk/busybox/coreutils/date.c
Changeset:
Modified: trunk/busybox/coreutils/date.c
===================================================================
--- trunk/busybox/coreutils/date.c 2006-12-13 00:19:34 UTC (rev 16865)
+++ trunk/busybox/coreutils/date.c 2006-12-13 00:35:21 UTC (rev 16866)
@@ -32,12 +32,18 @@
#define DATE_OPT_TIMESPEC 0x20
#define DATE_OPT_HINT 0x40
-static void maybe_set_utc(int opt)
+static void xputenv(char *s)
{
- if ((opt & DATE_OPT_UTC) && putenv("TZ=UTC0") != 0)
+ if (putenv(s) != 0)
bb_error_msg_and_die(bb_msg_memory_exhausted);
}
+static void maybe_set_utc(int opt)
+{
+ if (opt & DATE_OPT_UTC)
+ xputenv("TZ=UTC0");
+}
+
int date_main(int argc, char **argv)
{
time_t tm;
@@ -53,9 +59,9 @@
opt_complementary = "?:d--s:s--d"
USE_FEATURE_DATE_ISOFMT(":R--I:I--R");
opt = getopt32(argc, argv, "Rs:ud:r:"
- USE_FEATURE_DATE_ISOFMT("I::D:"),
- &date_str, &date_str, &filename
- USE_FEATURE_DATE_ISOFMT(, &isofmt_arg, &hintfmt_arg));
+ USE_FEATURE_DATE_ISOFMT("I::D:"),
+ &date_str, &date_str, &filename
+ USE_FEATURE_DATE_ISOFMT(, &isofmt_arg, &hintfmt_arg));
maybe_set_utc(opt);
if (ENABLE_FEATURE_DATE_ISOFMT && (opt & DATE_OPT_TIMESPEC)) {
@@ -205,6 +211,8 @@
date_fmt[i] = (opt & DATE_OPT_UTC) ? 'Z' : 'z';
}
} else if (opt & DATE_OPT_RFC2822) {
+ /* Undo busybox.c for date -R */
+ setlocale(LC_TIME, "C");
strcpy(date_fmt, "%a, %d %b %Y %H:%M:%S ");
i = 22;
goto format_utc;
More information about the busybox-cvs
mailing list