summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2009-06-18 20:16:06 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2009-06-18 20:16:06 +0000
commit8e9d054b4bbc6e3c9b88c6f76bbd48fa0e5cb64a (patch)
treef0bc140964e8ef24f2210522cd08fbc60d2155aa /usr.bin/mandoc
parentd1ea1302b311308a8006e544b2f23686e3651227 (diff)
sync to 1.7.16: footer in new groff style
Diffstat (limited to 'usr.bin/mandoc')
-rw-r--r--usr.bin/mandoc/mdoc_term.c34
1 files changed, 23 insertions, 11 deletions
diff --git a/usr.bin/mandoc/mdoc_term.c b/usr.bin/mandoc/mdoc_term.c
index 8b4087a224b..3b5bb9c1fbb 100644
--- a/usr.bin/mandoc/mdoc_term.c
+++ b/usr.bin/mandoc/mdoc_term.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_term.c,v 1.6 2009/06/18 01:19:02 schwarze Exp $ */
+/* $Id: mdoc_term.c,v 1.7 2009/06/18 20:16:05 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -395,6 +395,14 @@ print_foot(struct termp *p, const struct mdoc_meta *meta)
struct tm *tm;
char *buf, *os;
+ /*
+ * Output the footer in new-groff style, that is, three columns
+ * with the middle being the manual date and flanking columns
+ * being the operating system:
+ *
+ * SYSTEM DATE SYSTEM
+ */
+
if (NULL == (buf = malloc(p->rmargin)))
err(1, "malloc");
if (NULL == (os = malloc(p->rmargin)))
@@ -407,30 +415,34 @@ print_foot(struct termp *p, const struct mdoc_meta *meta)
(void)strlcpy(os, meta->os, p->rmargin);
- /*
- * This is /slightly/ different from regular groff output
- * because we don't have page numbers. Print the following:
- *
- * OS MDOCDATE
- */
-
term_vspace(p);
- p->flags |= TERMP_NOSPACE | TERMP_NOBREAK;
- p->rmargin = p->maxrmargin - strlen(buf);
p->offset = 0;
+ p->rmargin = (p->maxrmargin - strlen(buf) + 1) / 2;
+ p->flags |= TERMP_NOSPACE | TERMP_NOBREAK;
term_word(p, os);
term_flushln(p);
+ p->offset = p->rmargin;
+ p->rmargin = p->maxrmargin - strlen(os);
p->flags |= TERMP_NOLPAD | TERMP_NOSPACE;
+
+ term_word(p, buf);
+ term_flushln(p);
+
p->offset = p->rmargin;
p->rmargin = p->maxrmargin;
p->flags &= ~TERMP_NOBREAK;
+ p->flags |= TERMP_NOLPAD | TERMP_NOSPACE;
- term_word(p, buf);
+ term_word(p, os);
term_flushln(p);
+ p->offset = 0;
+ p->rmargin = p->maxrmargin;
+ p->flags = 0;
+
free(buf);
free(os);
}