summaryrefslogtreecommitdiffstats
path: root/man_term.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2011-11-13 15:33:41 +0000
committerIngo Schwarze <schwarze@openbsd.org>2011-11-13 15:33:41 +0000
commit5ef01561d45c2fa2522c7bb1151fd40ac6e6de19 (patch)
tree1a7edc7fc9d3fd8491517b1741ff455ae833fb46 /man_term.c
parent541d2505595d57aa03e2906599e79429e9f2ceaf (diff)
downloadmandoc-5ef01561d45c2fa2522c7bb1151fd40ac6e6de19.tar.gz
Make the man(7) page footer the same as in groff.
Diffstat (limited to 'man_term.c')
-rw-r--r--man_term.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/man_term.c b/man_term.c
index 09f3bb31..bafd55e4 100644
--- a/man_term.c
+++ b/man_term.c
@@ -958,6 +958,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;
@@ -967,28 +969,33 @@ print_man_foot(struct termp *p, const void *arg)
term_vspace(p);
term_vspace(p);
term_vspace(p);
+ snprintf(title, BUFSIZ, "%s(%s)", meta->title, meta->msec);
+ 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);
}