diff options
Diffstat (limited to 'mdoc_validate.c')
-rw-r--r-- | mdoc_validate.c | 17 |
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); } |