From d84dfd0f3f627fae37aa64d023492b885dee2eb5 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Sun, 7 Sep 2014 00:04:48 +0000 Subject: Allow .ll in the prologue; Daniel Levai reports Slackware Linux uses this. --- usr.bin/mandoc/mdoc_macro.c | 6 +++--- usr.bin/mandoc/mdoc_validate.c | 19 +++++++++---------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/usr.bin/mandoc/mdoc_macro.c b/usr.bin/mandoc/mdoc_macro.c index 07ab244e21f..aa845549c51 100644 --- a/usr.bin/mandoc/mdoc_macro.c +++ b/usr.bin/mandoc/mdoc_macro.c @@ -1,7 +1,7 @@ -/* $Id: mdoc_macro.c,v 1.98 2014/08/21 12:56:24 schwarze Exp $ */ +/* $OpenBSD: mdoc_macro.c,v 1.99 2014/09/07 00:04:47 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons - * Copyright (c) 2010, 2012, 2013 Ingo Schwarze + * Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -206,7 +206,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/usr.bin/mandoc/mdoc_validate.c b/usr.bin/mandoc/mdoc_validate.c index 0612989d5db..5a1e55e3c37 100644 --- a/usr.bin/mandoc/mdoc_validate.c +++ b/usr.bin/mandoc/mdoc_validate.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_validate.c,v 1.162 2014/08/19 17:28:57 schwarze Exp $ */ +/* $OpenBSD: mdoc_validate.c,v 1.163 2014/09/07 00:04:47 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons * Copyright (c) 2010-2014 Ingo Schwarze @@ -1642,18 +1642,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); } -- cgit v1.2.3