From 885ec428355f19a6d325f8c256a7fc514600de9b Mon Sep 17 00:00:00 2001 From: schwarze Date: Mon, 8 May 2017 20:33:40 +0000 Subject: Line-breaking roff(7) requests also break man(7) next-line scope. Considering that real roff implements next-line scope using input line traps, that isn't all that surprising. Issue found in the games/xbattle port. --- usr.bin/mandoc/man.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'usr.bin/mandoc/man.c') diff --git a/usr.bin/mandoc/man.c b/usr.bin/mandoc/man.c index 2d9eb25c215..c89fe0789ee 100644 --- a/usr.bin/mandoc/man.c +++ b/usr.bin/mandoc/man.c @@ -1,4 +1,4 @@ -/* $OpenBSD: man.c,v 1.120 2017/05/05 15:16:25 schwarze Exp $ */ +/* $OpenBSD: man.c,v 1.121 2017/05/08 20:33:40 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2013, 2014, 2015, 2017 Ingo Schwarze @@ -92,6 +92,7 @@ man_ptext(struct roff_man *man, int line, char *buf, int offs) */ if (buf[i] == '\0') { + man_breakscope(man, ROFF_sp); /* Allocate a blank entry. */ if (man->last->tok != MAN_SH && man->last->tok != MAN_SS) { @@ -256,7 +257,7 @@ man_breakscope(struct roff_man *man, int tok) * Delete the element that is being broken. */ - if (man->flags & MAN_ELINE && (tok == TOKEN_NONE || + if (man->flags & MAN_ELINE && (tok < MAN_TH || ! (man_macros[tok].flags & MAN_NSCOPED))) { n = man->last; assert(n->type != ROFFT_TEXT); @@ -265,8 +266,7 @@ man_breakscope(struct roff_man *man, int tok) mandoc_vmsg(MANDOCERR_BLK_LINE, man->parse, n->line, n->pos, "%s breaks %s", - tok == TOKEN_NONE ? "TS" : roff_name[tok], - roff_name[n->tok]); + roff_name[tok], roff_name[n->tok]); roff_node_delete(man, n); man->flags &= ~MAN_ELINE; @@ -292,7 +292,7 @@ man_breakscope(struct roff_man *man, int tok) * Delete the block that is being broken. */ - if (man->flags & MAN_BLINE && (tok == TOKEN_NONE || + if (man->flags & MAN_BLINE && (tok < MAN_TH || man_macros[tok].flags & MAN_BSCOPE)) { n = man->last; if (n->type == ROFFT_TEXT) @@ -307,8 +307,7 @@ man_breakscope(struct roff_man *man, int tok) mandoc_vmsg(MANDOCERR_BLK_LINE, man->parse, n->line, n->pos, "%s breaks %s", - tok == TOKEN_NONE ? "TS" : roff_name[tok], - roff_name[n->tok]); + roff_name[tok], roff_name[n->tok]); roff_node_delete(man, n); man->flags &= ~MAN_BLINE; -- cgit v1.2.3-59-g8ed1b