- mac[i - 1] = 0;
-
- if (i == 5 || i <= 1) {
- warnx("unknown macro: %s", mac);
- goto err;
- }
-
- if (MAN_MAX == (c = man_hash_find(m->htab, mac))) {
- warnx("unknown macro: %s", mac);
- goto err;
+ /*
+ * A block header next line scope is open,
+ * and the new macro is not allowed inside block headers.
+ * Delete the block that is being broken.
+ */
+
+ if (man->flags & MAN_BLINE && tok != ROFF_nf && tok != ROFF_fi &&
+ (tok < MAN_TH || man_macro(tok)->flags & MAN_XSCOPE)) {
+ n = man->last;
+ if (n->type == ROFFT_TEXT)
+ n = n->parent;
+ if (n->tok < MAN_TH ||
+ (man_macro(n->tok)->flags & MAN_XSCOPE) == 0)
+ n = n->parent;
+
+ assert(n->type == ROFFT_HEAD);
+ n = n->parent;
+ assert(n->type == ROFFT_BLOCK);
+ assert(man_macro(n->tok)->flags & MAN_BSCOPED);
+
+ mandoc_msg(MANDOCERR_BLK_LINE, n->line, n->pos,
+ "%s breaks %s", roff_name[tok], roff_name[n->tok]);
+
+ roff_node_delete(man, n);
+ man->flags &= ~(MAN_BLINE | ROFF_NONOFILL);