From 7113944571eb8954664d41200813db1a1d5e1d02 Mon Sep 17 00:00:00 2001 From: Kristaps Dzonsons Date: Mon, 11 Oct 2010 15:46:19 +0000 Subject: [PATCH] Use proper error for `An' multiple arguments. Making IGNARGV be an ERROR, not a WARNING, as information is lost. --- main.c | 4 ++-- mandoc.h | 4 ++-- mdoc_validate.c | 11 ++++++----- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/main.c b/main.c index 97c3390b..4d94a3ca 100644 --- a/main.c +++ b/main.c @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.107 2010/09/27 09:26:27 kristaps Exp $ */ +/* $Id: main.c,v 1.108 2010/10/11 15:46:19 kristaps Exp $ */ /* * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons * Copyright (c) 2010 Ingo Schwarze @@ -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 12b267ea..140e06d4 100644 --- a/mandoc.h +++ b/mandoc.h @@ -1,4 +1,4 @@ -/* $Id: mandoc.h,v 1.22 2010/10/04 07:01:02 kristaps Exp $ */ +/* $Id: mandoc.h,v 1.23 2010/10/11 15:46:19 kristaps Exp $ */ /* * Copyright (c) 2010 Kristaps Dzonsons * @@ -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 e147a684..0553c045 100644 --- a/mdoc_validate.c +++ b/mdoc_validate.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_validate.c,v 1.120 2010/10/11 13:24:33 kristaps Exp $ */ +/* $Id: mdoc_validate.c,v 1.121 2010/10/11 15:46:19 kristaps Exp $ */ /* * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons * @@ -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) -- 2.47.1