aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2015-02-06 09:38:43 +0000
committerIngo Schwarze <schwarze@openbsd.org>2015-02-06 09:38:43 +0000
commit21757403990ffaeb488a62351a28bc9c74eef267 (patch)
tree110a5ad758af98378512ae4edce6445f045925cd
parentd8b17016dd40c058e6cbfc2f195d4a2ac296d65e (diff)
downloadmandoc-21757403990ffaeb488a62351a28bc9c74eef267.tar.gz
mandoc-21757403990ffaeb488a62351a28bc9c74eef267.tar.zst
mandoc-21757403990ffaeb488a62351a28bc9c74eef267.zip
better diagnostics about excess arguments to .PD .ft .sp
-rw-r--r--man_macro.c9
-rw-r--r--man_validate.c11
-rw-r--r--mandoc.16
3 files changed, 14 insertions, 12 deletions
diff --git a/man_macro.c b/man_macro.c
index 06a1d05d..96f3f581 100644
--- a/man_macro.c
+++ b/man_macro.c
@@ -1,4 +1,4 @@
-/* $Id: man_macro.c,v 1.96 2015/02/06 08:28:35 schwarze Exp $ */
+/* $Id: man_macro.c,v 1.97 2015/02/06 09:38:43 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2012, 2013, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -427,6 +427,13 @@ in_line_eoln(MACRO_PROT_ARGS)
man_macronames[tok], buf + *pos);
break;
}
+ if (buf[*pos] != '\0' && man->last != n &&
+ (tok == MAN_PD || tok == MAN_ft || tok == MAN_sp)) {
+ mandoc_vmsg(MANDOCERR_ARG_EXCESS,
+ man->parse, line, *pos, "%s ... %s",
+ man_macronames[tok], buf + *pos);
+ break;
+ }
la = *pos;
if ( ! man_args(man, line, pos, buf, &p))
break;
diff --git a/man_validate.c b/man_validate.c
index 682213b7..4a4c3560 100644
--- a/man_validate.c
+++ b/man_validate.c
@@ -39,7 +39,6 @@
typedef void (*v_check)(CHKARGS);
static void check_eq2(CHKARGS);
-static void check_le1(CHKARGS);
static void check_le5(CHKARGS);
static void check_par(CHKARGS);
static void check_part(CHKARGS);
@@ -85,7 +84,7 @@ static v_check man_valids[MAN_MAX] = {
check_part, /* RS */
NULL, /* DT */
post_UC, /* UC */
- check_le1, /* PD */
+ NULL, /* PD */
post_AT, /* AT */
NULL, /* in */
post_ft, /* ft */
@@ -182,7 +181,6 @@ check_##name(CHKARGS) \
}
INEQ_DEFINE(2, ==, eq2)
-INEQ_DEFINE(1, <=, le1)
INEQ_DEFINE(5, <=, le5)
static void
@@ -240,10 +238,6 @@ post_ft(CHKARGS)
n->line, n->pos, "ft %s", cp);
*cp = '\0';
}
-
- if (1 < n->nchild)
- mandoc_vmsg(MANDOCERR_ARGCOUNT, man->parse, n->line,
- n->pos, "want one child (have %d)", n->nchild);
}
static void
@@ -495,9 +489,6 @@ static void
post_vs(CHKARGS)
{
- if (n->tok == MAN_sp)
- check_le1(man, n);
-
if (NULL != n->prev)
return;
diff --git a/mandoc.1 b/mandoc.1
index d3871b95..19964788 100644
--- a/mandoc.1
+++ b/mandoc.1
@@ -1,4 +1,4 @@
-.\" $Id: mandoc.1,v 1.148 2015/02/06 08:28:35 schwarze Exp $
+.\" $Id: mandoc.1,v 1.149 2015/02/06 09:38:43 schwarze Exp $
.\"
.\" Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
.\" Copyright (c) 2012, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -1661,6 +1661,10 @@ are invoked with invalid arguments, the
.Ic \&RE
macro is invoked with more than one argument
or with a non-integer argument, the
+.Ic \&PD
+macro or the
+.Ic \&ft
+or
.Ic \&sp
request is invoked with more than one argument, or a request of the
.Ic \&de