diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2014-03-08 15:50:22 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2014-03-08 15:50:22 +0000 |
commit | 66f6cfa03b3b2ba7d54dff07150b9dce7e2777d0 (patch) | |
tree | 1fa1ee4fcf77dcc17eeaaeaac7197b2b0e6b4b76 /usr.bin/mandoc/man_term.c | |
parent | 39a1b516887e24b84f5b5062e03f73d1deb81c89 (diff) |
To find out whether .TP head arguments are same-line or next-line arguments,
use the MAN_LINE flag instead of the man_node line member.
This is required such that user-defined macros wrapping .TP work correctly.
Issue found by Havard Eidnes in Tcl_NewStringObj(3), reported via
the NetBSD bug tracking system and Thomas Klausner <wiz at NetBSD>.
Diffstat (limited to 'usr.bin/mandoc/man_term.c')
-rw-r--r-- | usr.bin/mandoc/man_term.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/usr.bin/mandoc/man_term.c b/usr.bin/mandoc/man_term.c index cde6fd9f8c9..79cc9d2030a 100644 --- a/usr.bin/mandoc/man_term.c +++ b/usr.bin/mandoc/man_term.c @@ -1,4 +1,4 @@ -/* $Id: man_term.c,v 1.94 2014/02/16 12:30:51 schwarze Exp $ */ +/* $Id: man_term.c,v 1.95 2014/03/08 15:50:21 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org> @@ -716,7 +716,7 @@ pre_TP(DECL_ARGS) /* Calculate offset. */ if (NULL != (nn = n->parent->head->child)) - if (nn->string && nn->parent->line == nn->line) + if (nn->string && 0 == (MAN_LINE & nn->flags)) if ((ival = a2width(p, nn->string)) >= 0) len = (size_t)ival; @@ -733,9 +733,14 @@ pre_TP(DECL_ARGS) mt->fl &= ~MANT_LITERAL; /* Don't print same-line elements. */ - for (nn = n->child; nn; nn = nn->next) - if (nn->line > n->line) - print_man_node(p, mt, nn, meta); + nn = n->child; + while (NULL != nn && 0 == (MAN_LINE & nn->flags)) + nn = nn->next; + + while (NULL != nn) { + print_man_node(p, mt, nn, meta); + nn = nn->next; + } if (savelit) mt->fl |= MANT_LITERAL; |