diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2010-05-26 14:03:54 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2010-05-26 14:03:54 +0000 |
commit | b3536e4d2b9fcb0daf7141c545883a7d2b442e33 (patch) | |
tree | 0a8d32a41e44b15218981b5a3d71ddba079e7c69 /man_action.c | |
parent | 878d84055a253f63524c12172dd09c9044ad0afd (diff) | |
download | mandoc-b3536e4d2b9fcb0daf7141c545883a7d2b442e33.tar.gz |
Allow bad -man dates to flow verbatim into the front-ends. Noted by
Ulrich Spoerlein.
Diffstat (limited to 'man_action.c')
-rw-r--r-- | man_action.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/man_action.c b/man_action.c index baf4a3c2..b388e66f 100644 --- a/man_action.c +++ b/man_action.c @@ -136,8 +136,10 @@ post_TH(struct man *m) free(m->meta.source); if (m->meta.msec) free(m->meta.msec); + if (m->meta.rawdate) + free(m->meta.rawdate); - m->meta.title = m->meta.vol = + m->meta.title = m->meta.vol = m->meta.rawdate = m->meta.msec = m->meta.source = NULL; m->meta.date = 0; @@ -155,14 +157,21 @@ post_TH(struct man *m) /* TITLE MSEC ->DATE<- SOURCE VOL */ + /* + * Try to parse the date. If this works, stash the epoch (this + * is optimal because we can reformat it in the canonical form). + * If it doesn't parse, isn't specified at all, or is an empty + * string, then use the current date. + */ + n = n->next; - if (n) { + if (n && n->string && *n->string) { m->meta.date = mandoc_a2time (MTIME_ISO_8601, n->string); if (0 == m->meta.date) { if ( ! man_nmsg(m, n, MANDOCERR_BADDATE)) return(0); - m->meta.date = time(NULL); + m->meta.rawdate = mandoc_strdup(n->string); } } else m->meta.date = time(NULL); |