summaryrefslogtreecommitdiffstats
path: root/usr.bin/mandoc/man.c
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2017-05-08 20:33:40 +0000
committerschwarze <schwarze@openbsd.org>2017-05-08 20:33:40 +0000
commit885ec428355f19a6d325f8c256a7fc514600de9b (patch)
treebf14b2ede072e55bbfd6e0ff58e856f39daf81a8 /usr.bin/mandoc/man.c
parentReplace the global variables pfr_{sin,sin6} with stack local variables (diff)
downloadwireguard-openbsd-885ec428355f19a6d325f8c256a7fc514600de9b.tar.xz
wireguard-openbsd-885ec428355f19a6d325f8c256a7fc514600de9b.zip
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.
Diffstat (limited to 'usr.bin/mandoc/man.c')
-rw-r--r--usr.bin/mandoc/man.c13
1 files changed, 6 insertions, 7 deletions
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 <kristaps@bsd.lv>
* Copyright (c) 2013, 2014, 2015, 2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -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;