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 | d43a3b25e58b22f878cf000f42454792b509cd9d (patch) | |
tree | f725f25c5608192f76806b2200ac2124e11c1c92 /man_action.c | |
parent | edebd366803524ac2fde5ebf8a576ea4c29dabc3 (diff) | |
download | mandoc-d43a3b25e58b22f878cf000f42454792b509cd9d.tar.gz mandoc-d43a3b25e58b22f878cf000f42454792b509cd9d.tar.zst mandoc-d43a3b25e58b22f878cf000f42454792b509cd9d.zip |
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 | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/man_action.c b/man_action.c index a397b29c..e63d342b 100644 --- a/man_action.c +++ b/man_action.c @@ -1,4 +1,4 @@ -/* $Id: man_action.c,v 1.38 2010/05/24 13:36:53 kristaps Exp $ */ +/* $Id: man_action.c,v 1.39 2010/05/26 14:03:54 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -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); |