diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2014-03-08 15:50:41 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2014-03-08 15:50:41 +0000 |
commit | c3b19f4aeeab34b70784875fb9ac21067a5a5bc8 (patch) | |
tree | 6f798d47770eeb0f98527248c2c69e7434b4383f /man_term.c | |
parent | bdbb7d0355bd86cdd2bcaf08293edf32a911ebe5 (diff) | |
download | mandoc-c3b19f4aeeab34b70784875fb9ac21067a5a5bc8.tar.gz |
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.c | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -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; |