From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from krisdoz.my.domain (schwarze@localhost [127.0.0.1]) by krisdoz.my.domain (8.14.5/8.14.5) with ESMTP id s28FohRO021967 for ; Sat, 8 Mar 2014 10:50:43 -0500 (EST) Received: (from schwarze@localhost) by krisdoz.my.domain (8.14.5/8.14.3/Submit) id s28FogIP006883; Sat, 8 Mar 2014 10:50:42 -0500 (EST) Date: Sat, 8 Mar 2014 10:50:42 -0500 (EST) Message-Id: <201403081550.s28FogIP006883@krisdoz.my.domain> X-Mailinglist: mdocml-source Reply-To: source@mdocml.bsd.lv MIME-Version: 1.0 From: schwarze@mdocml.bsd.lv To: source@mdocml.bsd.lv Subject: mdocml: To find out whether .TP head arguments are same-line or X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Log Message: ----------- 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 . Modified Files: -------------- mdocml: man_term.c man_html.c tree.c Revision Data ------------- Index: man_html.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/man_html.c,v retrieving revision 1.90 retrieving revision 1.91 diff -Lman_html.c -Lman_html.c -u -p -r1.90 -r1.91 --- man_html.c +++ man_html.c @@ -1,7 +1,7 @@ /* $Id$ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons - * Copyright (c) 2013 Ingo Schwarze + * Copyright (c) 2013, 2014 Ingo Schwarze * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -553,10 +553,15 @@ man_IP_pre(MAN_ARGS) /* For TP, only print next-line header elements. */ - if (MAN_TP == n->tok) - for (nn = n->child; nn; nn = nn->next) - if (nn->line > n->line) - print_man_node(man, nn, mh, h); + if (MAN_TP == n->tok) { + nn = n->child; + while (NULL != nn && 0 == (MAN_LINE & nn->flags)) + nn = nn->next; + while (NULL != nn) { + print_man_node(man, nn, mh, h); + nn = nn->next; + } + } return(0); } Index: man_term.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/man_term.c,v retrieving revision 1.140 retrieving revision 1.141 diff -Lman_term.c -Lman_term.c -u -p -r1.140 -r1.141 --- man_term.c +++ 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; Index: tree.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/tree.c,v retrieving revision 1.50 retrieving revision 1.51 diff -Ltree.c -Ltree.c -u -p -r1.50 -r1.51 --- tree.c +++ tree.c @@ -1,7 +1,7 @@ /* $Id$ */ /* * Copyright (c) 2008, 2009, 2011 Kristaps Dzonsons - * Copyright (c) 2013 Ingo Schwarze + * Copyright (c) 2013, 2014 Ingo Schwarze * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -252,7 +252,10 @@ print_man(const struct man_node *n, int } else { for (i = 0; i < indent; i++) putchar('\t'); - printf("%s (%s) %d:%d\n", p, t, n->line, n->pos); + printf("%s (%s) ", p, t); + if (MAN_LINE & n->flags) + putchar('*'); + printf("%d:%d\n", n->line, n->pos); } if (n->child) -- To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv