=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/Attic/man_action.c,v retrieving revision 1.22 retrieving revision 1.23 diff -u -r1.22 -r1.23 --- src/usr.bin/mandoc/Attic/man_action.c 2010/05/24 13:42:58 1.22 +++ src/usr.bin/mandoc/Attic/man_action.c 2010/06/06 18:08:41 1.23 @@ -1,4 +1,4 @@ -/* $Id: man_action.c,v 1.22 2010/05/24 13:42:58 schwarze Exp $ */ +/* $Id: man_action.c,v 1.23 2010/06/06 18:08:41 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -133,8 +133,10 @@ 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; @@ -152,14 +154,21 @@ /* 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);