From c3b19f4aeeab34b70784875fb9ac21067a5a5bc8 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Sat, 8 Mar 2014 15:50:41 +0000 Subject: 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 . --- man_term.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'man_term.c') diff --git a/man_term.c b/man_term.c index 8e7b4673..08ed0a02 100644 --- a/man_term.c +++ b/man_term.c @@ -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; -- cgit