summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc/man_term.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2011-11-13 15:46:05 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2011-11-13 15:46:05 +0000
commit5283aacecf7ce3c8ed5b87bfc800614878e91940 (patch)
tree4c08a2c69d940b3a6d482f8b2b4a8ab52ff642a0 /usr.bin/mandoc/man_term.c
parentfe678043843028efe087ce23f93b320389128e45 (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.
Diffstat (limited to 'usr.bin/mandoc/man_term.c')
-rw-r--r--usr.bin/mandoc/man_term.c20
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);
+ }
}