From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from scc-mailout.scc.kit.edu (scc-mailout.scc.kit.edu [129.13.185.202]) by krisdoz.my.domain (8.14.3/8.14.3) with ESMTP id pA1IHL2L010336 for ; Tue, 1 Nov 2011 14:17:21 -0400 (EDT) Received: from hekate.usta.de (asta-nat.asta.uni-karlsruhe.de [172.22.63.82]) by scc-mailout-02 with esmtp (Exim 4.72 #1) id 1RLItk-0001We-RE; Tue, 01 Nov 2011 19:17:20 +0100 Received: from donnerwolke.usta.de ([172.24.96.3]) by hekate.usta.de with esmtp (Exim 4.72) (envelope-from ) id 1RLItk-0000YL-Rl for tech@mdocml.bsd.lv; Tue, 01 Nov 2011 19:17:20 +0100 Received: from iris.usta.de ([172.24.96.5] helo=usta.de) by donnerwolke.usta.de with esmtp (Exim 4.72) (envelope-from ) id 1RLJq0-0000ko-UP for tech@mdocml.bsd.lv; Tue, 01 Nov 2011 20:17:32 +0100 Received: from schwarze by usta.de with local (Exim 4.72) (envelope-from ) id 1RLIkK-0004eI-Kr for tech@mdocml.bsd.lv; Tue, 01 Nov 2011 19:07:36 +0100 Date: Tue, 1 Nov 2011 19:07:36 +0100 From: Ingo Schwarze To: tech@mdocml.bsd.lv Subject: new man(7) footer formats Message-ID: <20111101180736.GS6817@iris.usta.de> X-Mailinglist: mdocml-tech Reply-To: tech@mdocml.bsd.lv MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Hi, let's replace the man(7) footer format we have now, which is neither compatible with groff nor similar to the mdoc(7) footer format, by two new footer formats, controlled by the new termp mdocstyle flag. Also, suppress the two additional blank lines after the header line and before the footer line in mdocstyle. To be applied on top of the last diff, "mdoc(7) output style for man(7)". OK? Ingo --- man_term.c.orig +++ man_term.c @@ -956,6 +956,8 @@ print_man_nodelist(DECL_ARGS) static void print_man_foot(struct termp *p, const void *arg) { + char title[BUFSIZ]; + size_t datelen; const struct man_meta *meta; meta = (const struct man_meta *)arg; @@ -963,30 +965,41 @@ print_man_foot(struct termp *p, const void *arg) term_fontrepl(p, TERMFONT_NONE); term_vspace(p); - term_vspace(p); - term_vspace(p); + if ( ! p->mdocstyle) { + term_vspace(p); + term_vspace(p); + snprintf(title, BUFSIZ, "%s(%s)", meta->title, meta->msec); + } else if (meta->source) { + strlcpy(title, meta->source, BUFSIZ); + } else { + title[0] = '\0'; + } + datelen = term_strlen(p, meta->date); p->flags |= TERMP_NOSPACE | TERMP_NOBREAK; - p->rmargin = p->maxrmargin - term_strlen(p, meta->date); p->offset = 0; - - /* term_strlen() can return zero. */ - if (p->rmargin == p->maxrmargin) - p->rmargin--; + p->rmargin = (p->maxrmargin - datelen + term_len(p, 1)) / 2; if (meta->source) term_word(p, meta->source); - if (meta->source) - term_word(p, ""); term_flushln(p); p->flags |= TERMP_NOSPACE; p->offset = p->rmargin; - p->rmargin = p->maxrmargin; - p->flags &= ~TERMP_NOBREAK; + p->rmargin = p->maxrmargin - term_strlen(p, title); + if (p->offset + datelen >= p->rmargin) + p->rmargin = p->offset + datelen; term_word(p, meta->date); term_flushln(p); + + p->flags &= ~TERMP_NOBREAK; + p->flags |= TERMP_NOSPACE; + p->offset = p->rmargin; + p->rmargin = p->maxrmargin; + + term_word(p, title); + term_flushln(p); } @@ -1054,6 +1067,8 @@ print_man_head(struct termp *p, const void *arg) */ term_vspace(p); - term_vspace(p); - term_vspace(p); + if ( ! p->mdocstyle) { + term_vspace(p); + term_vspace(p); + } } -- To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv