summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mdoc_macro.c4
-rw-r--r--mdoc_validate.c17
2 files changed, 10 insertions, 11 deletions
diff --git a/mdoc_macro.c b/mdoc_macro.c
index 30b5818c..183d0c73 100644
--- a/mdoc_macro.c
+++ b/mdoc_macro.c
@@ -1,7 +1,7 @@
/* $Id$ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2010, 2012, 2013 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -210,7 +210,7 @@ const struct mdoc_macro __mdoc_macros[MDOC_MAX] = {
{ in_line_eoln, 0 }, /* sp */
{ in_line_eoln, 0 }, /* %U */
{ phrase_ta, MDOC_CALLABLE | MDOC_PARSED | MDOC_JOIN }, /* Ta */
- { in_line_eoln, 0 }, /* ll */
+ { in_line_eoln, MDOC_PROLOGUE }, /* ll */
};
const struct mdoc_macro * const mdoc_macros = __mdoc_macros;
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);
}