summaryrefslogtreecommitdiffstats
path: root/strings.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-01-20 22:55:46 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-01-20 22:55:46 +0000
commite2762e29b6445ab6177b83521a279938a317605f (patch)
treef1daca9b424eb34693a3cb687aa7dba20226f4b0 /strings.c
parent7a6aee8ed3dc388c63c4711e3a8122b46d8740fb (diff)
downloadmandoc-e2762e29b6445ab6177b83521a279938a317605f.tar.gz
Added regression tests (just for prologue, for now).
Minor fixes in parsing prologue.
Diffstat (limited to 'strings.c')
-rw-r--r--strings.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/strings.c b/strings.c
index 631243e6..c07e6909 100644
--- a/strings.c
+++ b/strings.c
@@ -124,12 +124,18 @@ time_t
mdoc_atotime(const char *p)
{
struct tm tm;
+ char *pp;
(void)memset(&tm, 0, sizeof(struct tm));
- if (0 == strptime(p, "%b %d %Y", &tm))
+ if (xstrcmp(p, "$Mdocdate$"))
+ return(time(NULL));
+ if ((pp = strptime(p, "$Mdocdate$", &tm)) && 0 == *pp)
return(mktime(&tm));
- if (0 == strptime(p, "%b %d, %Y", &tm))
+ /* XXX - this matches "June 1999", which is wrong. */
+ if ((pp = strptime(p, "%b %d %Y", &tm)) && 0 == *pp)
+ return(mktime(&tm));
+ if ((pp = strptime(p, "%b %d, %Y", &tm)) && 0 == *pp)
return(mktime(&tm));
return(0);