summaryrefslogtreecommitdiffstatshomepage
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
commit2b3f4260250d09aee45d955266bc57b3e5efe335 (patch)
tree6c2b96da58d412f35855e7887c87922e52201767 /mdoc.c
parent7ac873295958b94652c6afe6869cab75433c5e4d (diff)
downloadmandoc-2b3f4260250d09aee45d955266bc57b3e5efe335.tar.gz
mandoc-2b3f4260250d09aee45d955266bc57b3e5efe335.tar.zst
mandoc-2b3f4260250d09aee45d955266bc57b3e5efe335.zip
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.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/mdoc.c b/mdoc.c
index 7e1d0f4b..d5e4d1b0 100644
--- a/mdoc.c
+++ b/mdoc.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc.c,v 1.119 2010/04/03 13:02:35 kristaps Exp $ */
+/* $Id: mdoc.c,v 1.120 2010/04/05 08:59:46 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -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));