Accept empty -T arguments.

Proposed by:	clemens fischer <ino-qc@spotteswoode.de.eu.org>
This commit is contained in:
Poul-Henning Kamp 2008-03-31 13:56:15 +00:00
parent 753eda06f3
commit 8d2888bc54
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=177795
2 changed files with 5 additions and 1 deletions

View File

@ -16,6 +16,8 @@ test: ${PROG}
./${PROG} -t /tmp/fifolog.0
./${PROG} /tmp/fifolog.1
./${PROG} -B "00:00" /tmp/fifolog.1
./${PROG} -T "%y%m%d-%H%M%S" /tmp/fifolog.1
./${PROG} -T "" /tmp/fifolog.1
t2:
./${PROG} -t /critter/10.1.29.74.fifolog

View File

@ -59,7 +59,9 @@ Render(void *priv __unused, time_t now, unsigned flag __unused, const unsigned c
if (opt_R != NULL && regexec(&R, (const char *)p, 0, NULL, 0))
return;
if (opt_T != NULL) {
if (opt_T != NULL && *opt_T == '\0') {
fprintf(fo, "%s\n", p);
} else if (opt_T != NULL) {
(void)gmtime_r(&now, &utc);
i = strftime(buf, sizeof buf, opt_T, &utc);
assert(i > 0);