diff options
-rw-r--r-- | mandoc.h | 3 | ||||
-rw-r--r-- | mdoc_validate.c | 30 | ||||
-rw-r--r-- | read.c | 3 |
3 files changed, 25 insertions, 11 deletions
@@ -100,11 +100,12 @@ enum mandocerr { MANDOCERR_ARG_STD, /* missing -std argument, adding it: macro */ /* related to bad arguments */ - MANDOCERR_IGNARGV, /* skipping argument */ MANDOCERR_ARG_QUOTE, /* unterminated quoted argument */ MANDOCERR_ARG_REP, /* duplicate argument: macro arg */ + MANDOCERR_AN_REP, /* skipping duplicate argument: An -arg */ MANDOCERR_BD_REP, /* skipping duplicate display type: type */ MANDOCERR_BL_REP, /* skipping duplicate list type: type */ + MANDOCERR_BL_SKIPW, /* skipping -width argument: Bl -type */ MANDOCERR_AT_BAD, /* unknown AT&T UNIX version: version */ MANDOCERR_RS_BAD, /* invalid content in Rs block: macro */ MANDOCERR_SM_BAD, /* invalid Boolean argument: macro arg */ 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(); @@ -144,11 +144,12 @@ static const char * const mandocerrs[MANDOCERR_MAX] = { "missing -std argument, adding it", /* related to bad macro arguments */ - "skipping argument", "unterminated quoted argument", "duplicate argument", + "skipping duplicate argument", "skipping duplicate display type", "skipping duplicate list type", + "skipping -width argument", "unknown AT&T UNIX version", "invalid content in Rs block", "invalid Boolean argument", |