mirror of
https://github.com/sheumann/hush.git
synced 2025-02-28 20:31:33 +00:00
date: -R shouldn't use locale
This commit is contained in:
parent
5e2db5e8ee
commit
35a4bbe74f
@ -32,10 +32,16 @@
|
|||||||
#define DATE_OPT_TIMESPEC 0x20
|
#define DATE_OPT_TIMESPEC 0x20
|
||||||
#define DATE_OPT_HINT 0x40
|
#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)
|
static void maybe_set_utc(int opt)
|
||||||
{
|
{
|
||||||
if ((opt & DATE_OPT_UTC) && putenv("TZ=UTC0") != 0)
|
if (opt & DATE_OPT_UTC)
|
||||||
bb_error_msg_and_die(bb_msg_memory_exhausted);
|
xputenv("TZ=UTC0");
|
||||||
}
|
}
|
||||||
|
|
||||||
int date_main(int argc, char **argv)
|
int date_main(int argc, char **argv)
|
||||||
@ -53,9 +59,9 @@ int date_main(int argc, char **argv)
|
|||||||
opt_complementary = "?:d--s:s--d"
|
opt_complementary = "?:d--s:s--d"
|
||||||
USE_FEATURE_DATE_ISOFMT(":R--I:I--R");
|
USE_FEATURE_DATE_ISOFMT(":R--I:I--R");
|
||||||
opt = getopt32(argc, argv, "Rs:ud:r:"
|
opt = getopt32(argc, argv, "Rs:ud:r:"
|
||||||
USE_FEATURE_DATE_ISOFMT("I::D:"),
|
USE_FEATURE_DATE_ISOFMT("I::D:"),
|
||||||
&date_str, &date_str, &filename
|
&date_str, &date_str, &filename
|
||||||
USE_FEATURE_DATE_ISOFMT(, &isofmt_arg, &hintfmt_arg));
|
USE_FEATURE_DATE_ISOFMT(, &isofmt_arg, &hintfmt_arg));
|
||||||
maybe_set_utc(opt);
|
maybe_set_utc(opt);
|
||||||
|
|
||||||
if (ENABLE_FEATURE_DATE_ISOFMT && (opt & DATE_OPT_TIMESPEC)) {
|
if (ENABLE_FEATURE_DATE_ISOFMT && (opt & DATE_OPT_TIMESPEC)) {
|
||||||
@ -205,6 +211,8 @@ format_utc:
|
|||||||
date_fmt[i] = (opt & DATE_OPT_UTC) ? 'Z' : 'z';
|
date_fmt[i] = (opt & DATE_OPT_UTC) ? 'Z' : 'z';
|
||||||
}
|
}
|
||||||
} else if (opt & DATE_OPT_RFC2822) {
|
} 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 ");
|
strcpy(date_fmt, "%a, %d %b %Y %H:%M:%S ");
|
||||||
i = 22;
|
i = 22;
|
||||||
goto format_utc;
|
goto format_utc;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user