summaryrefslogtreecommitdiffstats
path: root/mdoc.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-04-05 08:59:46 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-04-05 08:59:46 +0000
commit1edec9cc4a5ff272a74ba07eaa7331ac21e3b3bb (patch)
treedd36c8dc1f63ad12e3e3058ccd5573d44a25fff2 /mdoc.c
parent7712235518f4f0e8306d12c39d6a78320510875b (diff)
downloadmandoc-1edec9cc4a5ff272a74ba07eaa7331ac21e3b3bb.tar.gz
Commited relaxation of title-less document error-out noted by Christian Weisgerber and patched by Ingo Schwarze.
Diffstat (limited to 'mdoc.c')
-rw-r--r--mdoc.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/mdoc.c b/mdoc.c
index 05d75cfd..b0231e29 100644
--- a/mdoc.c
+++ b/mdoc.c
@@ -26,6 +26,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <time.h>
#include "libmdoc.h"
#include "libmandoc.h"
@@ -351,8 +352,22 @@ mdoc_macro(struct mdoc *m, enum mdoct tok,
* we're in the body, deny prologue calls.
*/
if (MDOC_PROLOGUE & mdoc_macros[tok].flags &&
- MDOC_PBODY & m->flags)
- return(mdoc_perr(m, ln, pp, EPROLBODY));
+ MDOC_PBODY & m->flags) {
+ if ( ! mdoc_pwarn(m, ln, pp, EBODYPROL))
+ return(0);
+ /*
+ * FIXME: do this in mdoc_action.c.
+ */
+ 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;
+ }
if ( ! (MDOC_PROLOGUE & mdoc_macros[tok].flags) &&
! (MDOC_PBODY & m->flags))
return(mdoc_perr(m, ln, pp, EBODYPROL));