summaryrefslogtreecommitdiffstats
path: root/mdoc_validate.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-09-07 00:05:28 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-09-07 00:05:28 +0000
commit7efdd523df89a52dfe9b30c162bab842bb81840d (patch)
tree9780fb472fd6835a6095b59dedb6cc26bdbff672 /mdoc_validate.c
parent29fda0e9758370f8c242409db0c06dc1d75972df (diff)
downloadmandoc-7efdd523df89a52dfe9b30c162bab842bb81840d.tar.gz
Allow .ll in the prologue; Daniel Levai reports Slackware Linux uses this.
Diffstat (limited to 'mdoc_validate.c')
-rw-r--r--mdoc_validate.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/mdoc_validate.c b/mdoc_validate.c
index f97f1dfb..943b466f 100644
--- a/mdoc_validate.c
+++ b/mdoc_validate.c
@@ -1643,18 +1643,17 @@ post_root(POST_ARGS)
mdoc->meta.os = mandoc_strdup("");
}
- n = mdoc->first;
- assert(n);
-
/* Check that we begin with a proper `Sh'. */
- if (NULL == n->child)
- mandoc_msg(MANDOCERR_DOC_EMPTY, mdoc->parse,
- n->line, n->pos, NULL);
- else if (MDOC_Sh != n->child->tok)
+ n = mdoc->first->child;
+ while (n != NULL && mdoc_macros[n->tok].flags & MDOC_PROLOGUE)
+ n = n->next;
+
+ if (n == NULL)
+ mandoc_msg(MANDOCERR_DOC_EMPTY, mdoc->parse, 0, 0, NULL);
+ else if (n->tok != MDOC_Sh)
mandoc_msg(MANDOCERR_SEC_BEFORE, mdoc->parse,
- n->child->line, n->child->pos,
- mdoc_macronames[n->child->tok]);
+ n->line, n->pos, mdoc_macronames[n->tok]);
return(1);
}