--- dateshift-1.1.old/dateshift.1 +++ dateshift-1.1/dateshift.1 @@ -4,7 +4,11 @@ dateshift \- Moves system date for program under test .SH "SYNTAX" .LP -dateshift -t "<\fIYYYY\-MM\-DD\fP> [\fIHH:MM:SS\fP]" [ \- ] +dateshift -t "\fIYYYY\-MM\-DD\fP [\fIHH:MM:SS\fP]" [ \- ] +.br +(or) +.br +dateshift -t "\fIYYYYMMDD\fP [\fIHH:MM:SS\fP]" [ \- ] .SH "DESCRIPTION" .LP Moves system date for program under test. Once the date is moved the clock continues ticking, so that the program under test is now in a time warp. --- dateshift-1.1.old/dateshift.c +++ dateshift-1.1/dateshift.c @@ -11,10 +11,12 @@ static void usage(void) { fprintf(stderr, - "usage: dateshift -t \"YYYY-MM-DD [HH:MM:SS]\" [- ]\n"); - fprintf(stderr, "Allows the modification of system time for command\n\n"); +"usage: dateshift -t \"YYYY-MM-DD [HH:MM:SS]\" [- ] (or)\n"); + fprintf(stderr, +" dateshift -t \"YYYYMMDD [HH:MM:SS]\" [- ]\n"); + fprintf(stderr, "Modifies system time for specified command\n\n"); fprintf(stderr, "Options:\n"); - fprintf(stderr, "\t-h\tThis help\n"); + fprintf(stderr, "\t-h\tDisplays this help text\n"); fprintf(stderr, "\t-v\tVersion info\n"); fprintf(stderr, "\t-t\tNew date/time to shift to\n"); fprintf(stderr, "\t-d\tVerbose output\n"); @@ -176,6 +178,12 @@ fprintf(stderr, "You must specify a date/time to shift to\n"); usage(); exit(1); + } else if (strlen(datetext) == 8) { + dp = strptime(datetext, "%Y%m%d", &newtime); + if (dp == NULL) { + fprintf(stderr, "Invalid date: %s\n", datetext); + exit(1); + } } else if (strlen(datetext) == 10) { dp = strptime(datetext, "%Y-%m-%d", &newtime); if (dp == NULL) {