date: -R shouldn't use locale

This commit is contained in:
Denis Vlasenko 2006-12-13 00:35:21 +00:00
parent 5e2db5e8ee
commit 35a4bbe74f

View File

@ -32,10 +32,16 @@
#define DATE_OPT_TIMESPEC 0x20
#define DATE_OPT_HINT 0x40
static void xputenv(char *s)
{
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) && putenv("TZ=UTC0") != 0)
bb_error_msg_and_die(bb_msg_memory_exhausted);
if (opt & DATE_OPT_UTC)
xputenv("TZ=UTC0");
}
int date_main(int argc, char **argv)
@ -205,6 +211,8 @@ format_utc:
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;