aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/man_term.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-03-08 15:50:41 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-03-08 15:50:41 +0000
commit49fc5b876caef96271d1484f9279fd423d9b04ff (patch)
tree2481fb8c1879205cf8562044b10854e2c7d3b99c /man_term.c
parentb84bd4ac18eff0a7d806eaa88660b64abf998cf2 (diff)
downloadmandoc-49fc5b876caef96271d1484f9279fd423d9b04ff.tar.gz
mandoc-49fc5b876caef96271d1484f9279fd423d9b04ff.tar.zst
mandoc-49fc5b876caef96271d1484f9279fd423d9b04ff.zip
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 'man_term.c')
-rw-r--r--man_term.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/man_term.c b/man_term.c
index 10378d3a..3c059283 100644
--- a/man_term.c
+++ b/man_term.c
@@ -1,4 +1,4 @@
-/* $Id: man_term.c,v 1.140 2014/02/16 12:33:39 schwarze Exp $ */
+/* $Id: man_term.c,v 1.141 2014/03/08 15:50:41 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -720,7 +720,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;
@@ -737,9 +737,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;