summaryrefslogtreecommitdiffstats
path: root/mdoc_validate.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-07-31 09:22:21 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-07-31 09:22:21 +0000
commit1004133003f9d9a7e7783789c69eeb59bba73d1b (patch)
tree29f3f6d665ab75a36d4d6b3fd4793b1c7757de5c /mdoc_validate.c
parent5a362245c3c1c09a5513aea71ecdde2ff478b0c9 (diff)
downloadmandoc-1004133003f9d9a7e7783789c69eeb59bba73d1b.tar.gz
Split MANDOCERR_IGNARGV into one message for .An and one for .Bl
and report the macro name and argument.
Diffstat (limited to 'mdoc_validate.c')
-rw-r--r--mdoc_validate.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/mdoc_validate.c b/mdoc_validate.c
index 6913c8ef..ce4fe96c 100644
--- a/mdoc_validate.c
+++ b/mdoc_validate.c
@@ -568,8 +568,9 @@ static int
pre_bl(PRE_ARGS)
{
struct mdoc_node *np;
- struct mdoc_argv *argv;
+ struct mdoc_argv *argv, *wa;
int i;
+ enum mdocargt mdoclt;
enum mdoc_list lt;
if (MDOC_BLOCK != n->type) {
@@ -591,6 +592,8 @@ pre_bl(PRE_ARGS)
* ones. If we find no list type, we default to LIST_item.
*/
+ wa = n->args->argv;
+ mdoclt = MDOC_ARG_MAX;
for (i = 0; n->args && i < (int)n->args->argc; i++) {
argv = n->args->argv + i;
lt = LIST__NONE;
@@ -638,6 +641,7 @@ pre_bl(PRE_ARGS)
n->norm->Bl.comp = 1;
break;
case MDOC_Width:
+ wa = argv;
if (0 == argv->sz) {
mandoc_msg(MANDOCERR_ARG_EMPTY,
mdoc->parse, argv->line,
@@ -671,6 +675,7 @@ pre_bl(PRE_ARGS)
}
if (LIST__NONE == lt)
continue;
+ mdoclt = argv->arg;
/* Check: multiple list types. */
@@ -726,7 +731,9 @@ pre_bl(PRE_ARGS)
/* FALLTHROUGH */
case LIST_item:
if (n->norm->Bl.width)
- mdoc_nmsg(mdoc, n, MANDOCERR_IGNARGV);
+ mandoc_vmsg(MANDOCERR_BL_SKIPW, mdoc->parse,
+ wa->line, wa->pos, "Bl -%s",
+ mdoc_argnames[mdoclt]);
break;
case LIST_bullet:
/* FALLTHROUGH */
@@ -838,18 +845,23 @@ pre_bd(PRE_ARGS)
static int
pre_an(PRE_ARGS)
{
- int i;
+ struct mdoc_argv *argv;
+ size_t i;
- if (NULL == n->args)
+ if (n->args == NULL)
return(1);
- for (i = 1; i < (int)n->args->argc; i++)
- mdoc_pmsg(mdoc, n->args->argv[i].line,
- n->args->argv[i].pos, MANDOCERR_IGNARGV);
+ for (i = 1; i < n->args->argc; i++) {
+ argv = n->args->argv + i;
+ mandoc_vmsg(MANDOCERR_AN_REP,
+ mdoc->parse, argv->line, argv->pos,
+ "An -%s", mdoc_argnames[argv->arg]);
+ }
- if (MDOC_Split == n->args->argv[0].arg)
+ argv = n->args->argv;
+ if (argv->arg == MDOC_Split)
n->norm->An.auth = AUTH_split;
- else if (MDOC_Nosplit == n->args->argv[0].arg)
+ else if (argv->arg == MDOC_Nosplit)
n->norm->An.auth = AUTH_nosplit;
else
abort();