diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2011-11-13 15:46:05 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2011-11-13 15:46:05 +0000 |
commit | 5283aacecf7ce3c8ed5b87bfc800614878e91940 (patch) | |
tree | 4c08a2c69d940b3a6d482f8b2b4a8ab52ff642a0 | |
parent | fe678043843028efe087ce23f93b320389128e45 (diff) |
Implement mdoc(7)-like output style variant for man(7) documents:
* one instead of three blank lines after the page header;
* one instead of three blank lines before the page footer;
* source instead of title(section) in the lower right corner.
Select this style variant with the undocumented command line option -Omdoc.
-rw-r--r-- | usr.bin/mandoc/man_term.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/usr.bin/mandoc/man_term.c b/usr.bin/mandoc/man_term.c index ae3c25f6380..5112ec009d3 100644 --- a/usr.bin/mandoc/man_term.c +++ b/usr.bin/mandoc/man_term.c @@ -1,4 +1,4 @@ -/* $Id: man_term.c,v 1.78 2011/11/13 15:29:44 schwarze Exp $ */ +/* $Id: man_term.c,v 1.79 2011/11/13 15:46:04 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010, 2011 Ingo Schwarze <schwarze@openbsd.org> @@ -963,9 +963,15 @@ print_man_foot(struct termp *p, const void *arg) term_fontrepl(p, TERMFONT_NONE); term_vspace(p); - term_vspace(p); - term_vspace(p); - snprintf(title, BUFSIZ, "%s(%s)", meta->title, meta->msec); + 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; @@ -1059,6 +1065,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); + } } |