diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2010-10-11 15:46:19 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2010-10-11 15:46:19 +0000 |
commit | db589adcab1b561d91b7f4f4836220972ac0a979 (patch) | |
tree | ab6e0eafcc7d79665719434eaf8b29011e0d955b | |
parent | 2059a810480a8db91b8e50c2ef15ed9b542e2315 (diff) | |
download | mandoc-db589adcab1b561d91b7f4f4836220972ac0a979.tar.gz |
Use proper error for `An' multiple arguments.
Making IGNARGV be an ERROR, not a WARNING, as information is lost.
-rw-r--r-- | main.c | 2 | ||||
-rw-r--r-- | mandoc.h | 2 | ||||
-rw-r--r-- | mdoc_validate.c | 9 |
3 files changed, 7 insertions, 6 deletions
@@ -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", @@ -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) |