From 21a2b28bbf9477322208667281f6c561985a17d7 Mon Sep 17 00:00:00 2001 From: Kristaps Dzonsons Date: Wed, 9 Jun 2010 08:07:13 +0000 Subject: Have the standard manpage header and footer print on every page of -Tps output. This is more tricky than you may think: we can't just call the header function out-of-state (i.e., before a flushln has occured) because we'd clobber our current state. Thus, we call at the beginning and dump the output into an auxiliary buffer. For the record, I don't think there's any other clean way to do this. The only other Way That Works is to copy-aside *all* termp state, zero it, and do the necessary headf/footf. This is just as complex, as memory needs to be alloc'd and free'd per margin. Unfortunately, this prohibits page numbering (the margin is only printed once), so I'll probably end up re-writing this down the line. --- mdoc_term.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'mdoc_term.c') diff --git a/mdoc_term.c b/mdoc_term.c index 86a7fdde..35c169d6 100644 --- a/mdoc_term.c +++ b/mdoc_term.c @@ -65,9 +65,9 @@ static void print_bvspace(struct termp *, const struct mdoc_node *, const struct mdoc_node *); static void print_mdoc_node(DECL_ARGS); -static void print_mdoc_head(struct termp *, const void *); static void print_mdoc_nodelist(DECL_ARGS); -static void print_foot(struct termp *, const void *); +static void print_mdoc_head(struct termp *, const void *); +static void print_mdoc_foot(struct termp *, const void *); static void synopsis_pre(struct termp *, const struct mdoc_node *); @@ -276,7 +276,8 @@ terminal_mdoc(void *arg, const struct mdoc *mdoc) p->maxrmargin = p->defrmargin; p->tabwidth = 5; - term_begin(p, print_mdoc_head, print_foot, mdoc_meta(mdoc)); + term_begin(p, print_mdoc_head, + print_mdoc_foot, mdoc_meta(mdoc)); if (NULL == p->symtab) switch (p->enc) { @@ -348,9 +349,8 @@ print_mdoc_node(DECL_ARGS) } -/* ARGSUSED */ static void -print_foot(struct termp *p, const void *arg) +print_mdoc_foot(struct termp *p, const void *arg) { char buf[DATESIZ], os[BUFSIZ]; const struct mdoc_meta *m; @@ -400,7 +400,6 @@ print_foot(struct termp *p, const void *arg) } -/* ARGSUSED */ static void print_mdoc_head(struct termp *p, const void *arg) { -- cgit