From db589adcab1b561d91b7f4f4836220972ac0a979 Mon Sep 17 00:00:00 2001 From: Kristaps Dzonsons Date: Mon, 11 Oct 2010 15:46:19 +0000 Subject: Use proper error for `An' multiple arguments. Making IGNARGV be an ERROR, not a WARNING, as information is lost. --- main.c | 2 +- mandoc.h | 2 +- mdoc_validate.c | 9 +++++---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/main.c b/main.c index 24c574c2..fb8abec8 100644 --- a/main.c +++ b/main.c @@ -132,7 +132,6 @@ static const char * const mandocerrs[MANDOCERR_MAX] = { "unterminated quoted string", "argument requires the width argument", "superfluous width argument", - "ignoring argument", "bad date argument", "bad width argument", "unknown manual section", @@ -149,6 +148,7 @@ static const char * const mandocerrs[MANDOCERR_MAX] = { "list type repeated", "display type repeated", "argument repeated", + "ignoring argument", "manual name not yet set", "obsolete macro ignored", "empty macro ignored", diff --git a/mandoc.h b/mandoc.h index 77b23b97..bac43f24 100644 --- a/mandoc.h +++ b/mandoc.h @@ -59,7 +59,6 @@ enum mandocerr { MANDOCERR_NOWIDTHARG, /* argument requires the width argument */ /* FIXME: merge with MANDOCERR_IGNARGV. */ MANDOCERR_WIDTHARG, /* superfluous width argument */ - MANDOCERR_IGNARGV, /* ignoring argument */ MANDOCERR_BADDATE, /* bad date argument */ MANDOCERR_BADWIDTH, /* bad width argument */ MANDOCERR_BADMSEC, /* unknown manual section */ @@ -75,6 +74,7 @@ enum mandocerr { MANDOCERR_LISTREP, /* list type repeated */ MANDOCERR_DISPREP, /* display type repeated */ MANDOCERR_ARGVREP, /* argument repeated */ + MANDOCERR_IGNARGV, /* ignoring argument */ MANDOCERR_NONAME, /* manual name not yet set */ MANDOCERR_MACROOBS, /* obsolete macro ignored */ MANDOCERR_MACROEMPTY, /* empty macro ignored */ diff --git a/mdoc_validate.c b/mdoc_validate.c index 97c239f7..44679b1e 100644 --- a/mdoc_validate.c +++ b/mdoc_validate.c @@ -893,15 +893,16 @@ pre_it(PRE_ARGS) static int pre_an(PRE_ARGS) { + int i; if (NULL == n->args) return(1); - if (n->args->argc > 1) - if ( ! mdoc_nmsg(mdoc, n, MANDOCERR_ARGCOUNT)) + + for (i = 1; i < (int)n->args->argc; i++) + if ( ! mdoc_pmsg(mdoc, n->args->argv[i].line, + n->args->argv[i].pos, MANDOCERR_IGNARGV)) return(0); - /* FIXME: this should use a different error message. */ - if (MDOC_Split == n->args->argv[0].arg) n->data.An.auth = AUTH_split; else if (MDOC_Nosplit == n->args->argv[0].arg) -- cgit