diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2010-04-04 20:14:36 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2010-04-04 20:14:36 +0000 |
commit | 819bef7bd125bbccd7a5753c6207e68f6b2a427e (patch) | |
tree | 07193e1f015ffb457a24095174871471b5cefa04 /usr.bin/mandoc | |
parent | db12181352581903b27272ae49611b1093b5edbb (diff) |
When the prologue lacks required information, do not error out,
but warn, set up some default values, and prod on.
Unbreaking the ports build for textproc/sgmlformat;
reported by naddy@, thanks.
Diffstat (limited to 'usr.bin/mandoc')
-rw-r--r-- | usr.bin/mandoc/mdoc.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/usr.bin/mandoc/mdoc.c b/usr.bin/mandoc/mdoc.c index 13f3683450d..92f99390328 100644 --- a/usr.bin/mandoc/mdoc.c +++ b/usr.bin/mandoc/mdoc.c @@ -1,4 +1,4 @@ -/* $Id: mdoc.c,v 1.38 2010/04/03 16:24:17 schwarze Exp $ */ +/* $Id: mdoc.c,v 1.39 2010/04/04 20:14:35 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -22,6 +22,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <time.h> #include "libmdoc.h" #include "libmandoc.h" @@ -350,8 +351,19 @@ mdoc_macro(struct mdoc *m, enum mdoct tok, MDOC_PBODY & m->flags) return(mdoc_perr(m, ln, pp, EPROLBODY)); if ( ! (MDOC_PROLOGUE & mdoc_macros[tok].flags) && - ! (MDOC_PBODY & m->flags)) - return(mdoc_perr(m, ln, pp, EBODYPROL)); + ! (MDOC_PBODY & m->flags)) { + if ( ! mdoc_pwarn(m, ln, pp, EBODYPROL)) + return(0); + if (NULL == m->meta.title) + m->meta.title = mandoc_strdup("unknown"); + if (NULL == m->meta.vol) + m->meta.vol = mandoc_strdup("local"); + if (NULL == m->meta.os) + m->meta.os = mandoc_strdup("local"); + if (0 == m->meta.date) + m->meta.date = time(NULL); + m->flags |= MDOC_PBODY; + } return((*mdoc_macros[tok].fp)(m, tok, ln, pp, pos, buf)); } |