date: better version of previous commit; + fix testsuite

to have it checked
This commit is contained in:
Denis Vlasenko
2008-04-28 00:25:22 +00:00
parent e6520f0532
commit e4ed64067e
2 changed files with 22 additions and 19 deletions

View File

@ -79,9 +79,11 @@ int date_main(int argc ATTRIBUTE_UNUSED, char **argv)
if (!(opt & (DATE_OPT_SET | DATE_OPT_DATE))) {
opt |= DATE_OPT_SET;
date_str = argv[0]; /* can be NULL */
} else if (argv[0]) {
bb_show_usage();
if (date_str)
argv++;
}
if (*argv)
bb_show_usage();
/* Now we have parsed all the information except the date format
which depends on whether the clock is being set or read */