summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2015-02-05 01:46:39 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2015-02-05 01:46:39 +0000
commit58b5978a4979bccacfd37ca3d20f8173e83422ec (patch)
treedc50dcf718a8711457188fd162bff9bbf29323f1 /usr.bin/mandoc
parent3249c63187cc9cf174a23f9b5c82957879a1bb01 (diff)
fix handling of empty .An macros
Diffstat (limited to 'usr.bin/mandoc')
-rw-r--r--usr.bin/mandoc/mdoc_html.c5
-rw-r--r--usr.bin/mandoc/mdoc_macro.c4
-rw-r--r--usr.bin/mandoc/mdoc_term.c5
-rw-r--r--usr.bin/mandoc/mdoc_validate.c12
4 files changed, 11 insertions, 15 deletions
diff --git a/usr.bin/mandoc/mdoc_html.c b/usr.bin/mandoc/mdoc_html.c
index 2835470e487..80575e0b236 100644
--- a/usr.bin/mandoc/mdoc_html.c
+++ b/usr.bin/mandoc/mdoc_html.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mdoc_html.c,v 1.97 2015/02/05 00:13:34 schwarze Exp $ */
+/* $OpenBSD: mdoc_html.c,v 1.98 2015/02/05 01:46:38 schwarze Exp $ */
/*
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -1251,9 +1251,6 @@ mdoc_an_pre(MDOC_ARGS)
return(0);
}
- if (n->child == NULL)
- return(0);
-
if (h->flags & HTML_SPLIT)
print_otag(h, TAG_BR, 0, NULL);
diff --git a/usr.bin/mandoc/mdoc_macro.c b/usr.bin/mandoc/mdoc_macro.c
index c4c1a1e562b..cc00c8c1471 100644
--- a/usr.bin/mandoc/mdoc_macro.c
+++ b/usr.bin/mandoc/mdoc_macro.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mdoc_macro.c,v 1.131 2015/02/05 00:13:34 schwarze Exp $ */
+/* $OpenBSD: mdoc_macro.c,v 1.132 2015/02/05 01:46:38 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -770,7 +770,7 @@ in_line(MACRO_PROT_ARGS)
*/
if (ac == ARGS_PUNCT) {
- if (cnt == 0 && nc == 0)
+ if (cnt == 0 && (nc == 0 || tok == MDOC_An))
mdoc->flags |= MDOC_NODELIMC;
break;
}
diff --git a/usr.bin/mandoc/mdoc_term.c b/usr.bin/mandoc/mdoc_term.c
index d4e32ff4c1c..2434d19193e 100644
--- a/usr.bin/mandoc/mdoc_term.c
+++ b/usr.bin/mandoc/mdoc_term.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mdoc_term.c,v 1.206 2015/02/05 00:13:34 schwarze Exp $ */
+/* $OpenBSD: mdoc_term.c,v 1.207 2015/02/05 01:46:38 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -1089,9 +1089,6 @@ termp_an_pre(DECL_ARGS)
return(0);
}
- if (n->child == NULL)
- return(0);
-
if (p->flags & TERMP_SPLIT)
term_newln(p);
diff --git a/usr.bin/mandoc/mdoc_validate.c b/usr.bin/mandoc/mdoc_validate.c
index 1930d9861d0..81318d6261e 100644
--- a/usr.bin/mandoc/mdoc_validate.c
+++ b/usr.bin/mandoc/mdoc_validate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mdoc_validate.c,v 1.186 2015/02/04 22:29:28 schwarze Exp $ */
+/* $OpenBSD: mdoc_validate.c,v 1.187 2015/02/05 01:46:38 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -1159,10 +1159,12 @@ post_an(POST_ARGS)
struct mdoc_node *np, *nch;
np = mdoc->last;
- if (AUTH__NONE == np->norm->An.auth) {
- if (0 == np->child)
- check_count(mdoc, MDOC_ELEM, CHECK_GT, 0);
- } else if ((nch = np->child) != NULL)
+ nch = np->child;
+ if (np->norm->An.auth == AUTH__NONE) {
+ if (nch == NULL)
+ mandoc_msg(MANDOCERR_MACRO_EMPTY, mdoc->parse,
+ np->line, np->pos, "An");
+ } else if (nch != NULL)
mandoc_vmsg(MANDOCERR_ARG_EXCESS, mdoc->parse,
nch->line, nch->pos, "An ... %s", nch->string);
}