summaryrefslogtreecommitdiffstats
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
commita2da7908b98806106e371a1ff27e835194407859 (patch)
tree37eca625bf2d10bd6279bac7aa48420a2714f6de
parent7dfb85a6973abe199100f8b965b4751bd3516595 (diff)
downloadmandoc-a2da7908b98806106e371a1ff27e835194407859.tar.gz
better diagnostics about excess arguments to .PD .ft .sp
-rw-r--r--man_macro.c7
-rw-r--r--man_validate.c11
-rw-r--r--mandoc.14
3 files changed, 12 insertions, 10 deletions
diff --git a/man_macro.c b/man_macro.c
index 6ed50df7..88f1f431 100644
--- a/man_macro.c
+++ b/man_macro.c
@@ -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 b5b04079..6dbb4579 100644
--- a/mandoc.1
+++ b/mandoc.1
@@ -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