summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2015-02-06 08:28:35 +0000
committerIngo Schwarze <schwarze@openbsd.org>2015-02-06 08:28:35 +0000
commit7dfb85a6973abe199100f8b965b4751bd3516595 (patch)
tree06529cb808bdbb40056ae9490c37683cac4ec68f
parent0c49342c6e879353195f2df060ebceb497f66497 (diff)
downloadmandoc-7dfb85a6973abe199100f8b965b4751bd3516595.tar.gz
better error reporting for .br .fi .nf with arguments
-rw-r--r--man_macro.c7
-rw-r--r--man_validate.c12
-rw-r--r--mandoc.15
3 files changed, 13 insertions, 11 deletions
diff --git a/man_macro.c b/man_macro.c
index 39e219dc..6ed50df7 100644
--- a/man_macro.c
+++ b/man_macro.c
@@ -420,6 +420,13 @@ in_line_eoln(MACRO_PROT_ARGS)
n = man->last;
for (;;) {
+ if (buf[*pos] != '\0' && (tok == MAN_br ||
+ tok == MAN_fi || tok == MAN_nf)) {
+ mandoc_vmsg(MANDOCERR_ARG_SKIP,
+ 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 2e844d19..682213b7 100644
--- a/man_validate.c
+++ b/man_validate.c
@@ -38,7 +38,6 @@
typedef void (*v_check)(CHKARGS);
-static void check_eq0(CHKARGS);
static void check_eq2(CHKARGS);
static void check_le1(CHKARGS);
static void check_le5(CHKARGS);
@@ -182,7 +181,6 @@ check_##name(CHKARGS) \
#ineq, (x), n->nchild); \
}
-INEQ_DEFINE(0, ==, eq0)
INEQ_DEFINE(2, ==, eq2)
INEQ_DEFINE(1, <=, le1)
INEQ_DEFINE(5, <=, le5)
@@ -401,9 +399,7 @@ static void
post_nf(CHKARGS)
{
- check_eq0(man, n);
-
- if (MAN_LITERAL & man->flags)
+ if (man->flags & MAN_LITERAL)
mandoc_msg(MANDOCERR_NF_SKIP, man->parse,
n->line, n->pos, "nf");
@@ -414,8 +410,6 @@ static void
post_fi(CHKARGS)
{
- check_eq0(man, n);
-
if ( ! (MAN_LITERAL & man->flags))
mandoc_msg(MANDOCERR_FI_SKIP, man->parse,
n->line, n->pos, "fi");
@@ -501,9 +495,7 @@ static void
post_vs(CHKARGS)
{
- if (n->tok == MAN_br)
- check_eq0(man, n);
- else
+ if (n->tok == MAN_sp)
check_le1(man, n);
if (NULL != n->prev)
diff --git a/mandoc.1 b/mandoc.1
index 8a2124bf..b5b04079 100644
--- a/mandoc.1
+++ b/mandoc.1
@@ -1635,7 +1635,10 @@ or
.Ic \&EN
macro, or a
.Xr roff 7
-.Ic \&br
+.Ic \&br ,
+.Ic \&fi ,
+or
+.Ic \&nf
request or
.Sq \&..
block closing request is invoked with at least one argument.