summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.bin/mandoc/man.c31
1 files changed, 8 insertions, 23 deletions
diff --git a/usr.bin/mandoc/man.c b/usr.bin/mandoc/man.c
index 20b5bd8266d..7702d3adbae 100644
--- a/usr.bin/mandoc/man.c
+++ b/usr.bin/mandoc/man.c
@@ -1,4 +1,4 @@
-/* $Id: man.c,v 1.45 2010/11/29 00:12:02 schwarze Exp $ */
+/* $Id: man.c,v 1.46 2010/11/29 01:44:41 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -509,37 +509,22 @@ man_pmacro(struct man *m, int ln, char *buf, int offs)
goto err;
/*
- * Remove prior ELINE macro, as it's being clobbering by a new
+ * Remove prior ELINE macro, as it's being clobbered by a new
* macro. Note that NSCOPED macros do not close out ELINE
* macros---they don't print text---so we let those slip by.
*/
if ( ! (MAN_NSCOPED & man_macros[tok].flags) &&
m->flags & MAN_ELINE) {
- assert(MAN_TEXT != m->last->type);
-
- /*
- * This occurs in the following construction:
- * .B
- * .br
- * .B
- * .br
- * I hate man macros.
- * Flat-out disallow this madness.
- */
- if (MAN_NSCOPED & man_macros[m->last->tok].flags) {
- man_pmsg(m, ln, ppos, MANDOCERR_SYNTLINESCOPE);
- return(0);
- }
-
n = m->last;
+ assert(MAN_TEXT != n->type);
- assert(n);
- assert(NULL == n->child);
- assert(0 == n->nchild);
+ /* .B .br .br .B: remove prior including children */
+ if (MAN_NSCOPED & man_macros[n->tok].flags)
+ n = n->parent;
- if ( ! man_nmsg(m, n, MANDOCERR_LINESCOPE))
- return(0);
+ man_vmsg(m, MANDOCERR_LINESCOPE, n->line, n->pos,
+ "%s", man_macronames[n->tok]);
man_node_delete(m, n);
m->flags &= ~MAN_ELINE;