summaryrefslogtreecommitdiffstats
path: root/mdoc.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-04-08 07:06:15 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-04-08 07:06:15 +0000
commit381c538835408824c47a299e4b36c13e54923cdf (patch)
tree83def822fda4b44ef46da238bd4585c97316d076 /mdoc.c
parent9085ee212aa6894a65b5f254b99d53eb241d6300 (diff)
downloadmandoc-381c538835408824c47a299e4b36c13e54923cdf.tar.gz
Properly checked in Ingo Schwarze' prologue/body-breaking patch, which I'd munged.
Diffstat (limited to 'mdoc.c')
-rw-r--r--mdoc.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/mdoc.c b/mdoc.c
index cb134c7f..72573f33 100644
--- a/mdoc.c
+++ b/mdoc.c
@@ -348,19 +348,20 @@ int
mdoc_macro(struct mdoc *m, enum mdoct tok,
int ln, int pp, int *pos, char *buf)
{
-
assert(tok < MDOC_MAX);
- /*
- * If we're in the prologue, deny "body" macros. Similarly, if
- * we're in the body, deny prologue calls.
- */
+
+ /* If we're in the body, deny prologue calls. */
+
if (MDOC_PROLOGUE & mdoc_macros[tok].flags &&
- MDOC_PBODY & m->flags) {
+ MDOC_PBODY & m->flags)
+ return(mdoc_perr(m, ln, pp, EPROLBODY));
+
+ /* If we're in the prologue, deny "body" macros. */
+
+ if ( ! (MDOC_PROLOGUE & mdoc_macros[tok].flags) &&
+ ! (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)
@@ -371,9 +372,6 @@ mdoc_macro(struct mdoc *m, enum mdoct tok,
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));
return((*mdoc_macros[tok].fp)(m, tok, ln, pp, pos, buf));
}