diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2011-11-13 15:33:41 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2011-11-13 15:33:41 +0000 |
commit | 5ef01561d45c2fa2522c7bb1151fd40ac6e6de19 (patch) | |
tree | 1a7edc7fc9d3fd8491517b1741ff455ae833fb46 /man_term.c | |
parent | 541d2505595d57aa03e2906599e79429e9f2ceaf (diff) | |
download | mandoc-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.c | 25 |
1 files changed, 16 insertions, 9 deletions
@@ -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); } |