summaryrefslogtreecommitdiffstats
path: root/man.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2011-11-07 01:24:40 +0000
committerIngo Schwarze <schwarze@openbsd.org>2011-11-07 01:24:40 +0000
commit9830303b6541ca2717331d52b40997c9e566a48b (patch)
treebef7f838061058f52f46cf360a8feec0e93a87e9 /man.c
parenta3d2601486005576848664f22121fcd2881778e3 (diff)
downloadmandoc-9830303b6541ca2717331d52b40997c9e566a48b.tar.gz
When the HEAD scope of .TP is broken by another block macro,
do not abort with a FATAL error, but report a report a WARNING, remove the broken .TP from the syntax tree, and prod on. Reported repeatedly by ports people, at least by brad@ and jeremy@. Also fixes rendition(4) in Xenocara. ok kristaps@
Diffstat (limited to 'man.c')
-rw-r--r--man.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/man.c b/man.c
index 70ec1e64..f7c70d75 100644
--- a/man.c
+++ b/man.c
@@ -543,13 +543,40 @@ man_pmacro(struct man *m, int ln, char *buf, int offs)
n = n->parent;
mandoc_vmsg(MANDOCERR_LINESCOPE, m->parse, n->line,
- n->pos, "%s", man_macronames[n->tok]);
+ n->pos, "%s breaks %s", man_macronames[tok],
+ man_macronames[n->tok]);
man_node_delete(m, n);
m->flags &= ~MAN_ELINE;
}
/*
+ * Remove prior BLINE macro that is being clobbered.
+ */
+ if ((m->flags & MAN_BLINE) &&
+ (MAN_BSCOPE & man_macros[tok].flags)) {
+ n = m->last;
+ assert(MAN_TEXT != n->type);
+
+ /* Remove element that didn't end BLINE, if any. */
+
+ if ( ! (MAN_BSCOPE & man_macros[n->tok].flags))
+ n = n->parent;
+
+ assert(MAN_HEAD == n->type);
+ n = n->parent;
+ assert(MAN_BLOCK == n->type);
+ assert(MAN_SCOPED & man_macros[n->tok].flags);
+
+ mandoc_vmsg(MANDOCERR_LINESCOPE, m->parse, n->line,
+ n->pos, "%s breaks %s", man_macronames[tok],
+ man_macronames[n->tok]);
+
+ man_node_delete(m, n);
+ m->flags &= ~MAN_BLINE;
+ }
+
+ /*
* Save the fact that we're in the next-line for a block. In
* this way, embedded roff instructions can "remember" state
* when they exit.