aboutsummaryrefslogtreecommitdiff
path: root/toys/posix/date.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2014-05-24 12:51:53 -0500
committerRob Landley <rob@landley.net>2014-05-24 12:51:53 -0500
commit7dfee8efa743c7dffc3803109a143a4d6333556f (patch)
tree6035e06841be682ce38286e8d4deb1a8997ff20d /toys/posix/date.c
parent6c54928f1f68ce0378172737b449785d49147425 (diff)
downloadtoybox-7dfee8efa743c7dffc3803109a143a4d6333556f.tar.gz
Remove debug detritus I didn't mean to to check in, and treat an "this variable can never actually be used uninitialized but gcc's warning generator can't tell and fails spamwards" warning.
Diffstat (limited to 'toys/posix/date.c')
-rw-r--r--toys/posix/date.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/toys/posix/date.c b/toys/posix/date.c
index f56c4804..15aafb0b 100644
--- a/toys/posix/date.c
+++ b/toys/posix/date.c
@@ -95,13 +95,13 @@ int parse_posixdate(char *str, struct tm *tm)
void date_main(void)
{
char *setdate = *toys.optargs, *format_string = "%a %b %e %H:%M:%S %Z %Y",
- *tz;
+ *tz = 0;
time_t now = time(NULL);
struct tm tm;
// We can't just pass a timezone to mktime because posix.
if (toys.optflags & FLAG_u) {
- tz = CFG_TOYBOX_FREE ? getenv("TZ") : 0;
+ if (CFG_TOYBOX_FREE) tz = getenv("TZ");
setenv("TZ", "UTC", 1);
tzset();
}
@@ -114,7 +114,6 @@ void date_main(void)
} else if (TT.showdate) {
setdate = TT.showdate;
if (TT.setfmt) {
-printf("TT.showdate=%s TT.setfmt=%s\n", TT.showdate, TT.setfmt);
char *s = strptime(TT.showdate, TT.setfmt+(*TT.setfmt=='+'), &tm);
if (!s || *s) goto bad_date;