summaryrefslogtreecommitdiffstats
path: root/man_term.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2015-04-02 23:48:19 +0000
committerIngo Schwarze <schwarze@openbsd.org>2015-04-02 23:48:19 +0000
commit7355c805552e6fc47e10d976711b6169f0f3c0e0 (patch)
tree8ad95f5fc9d0dbda235694991290ea83f7484abe /man_term.c
parent9e6e3b6be0e9ffe29cf4876ce0b7ded2c3c386b9 (diff)
downloadmandoc-7355c805552e6fc47e10d976711b6169f0f3c0e0.tar.gz
Third step towards parser unification:
Replace struct mdoc_meta and struct man_meta by a unified struct roff_meta. Written of the train from London to Exeter on the way to p2k15.
Diffstat (limited to 'man_term.c')
-rw-r--r--man_term.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/man_term.c b/man_term.c
index 4fdd8a2b..473b25e4 100644
--- a/man_term.c
+++ b/man_term.c
@@ -49,7 +49,7 @@ struct mtermp {
#define DECL_ARGS struct termp *p, \
struct mtermp *mt, \
struct roff_node *n, \
- const struct man_meta *meta
+ const struct roff_meta *meta
struct termact {
int (*pre)(DECL_ARGS);
@@ -60,8 +60,10 @@ struct termact {
static void print_man_nodelist(DECL_ARGS);
static void print_man_node(DECL_ARGS);
-static void print_man_head(struct termp *, const void *);
-static void print_man_foot(struct termp *, const void *);
+static void print_man_head(struct termp *,
+ const struct roff_meta *);
+static void print_man_foot(struct termp *,
+ const struct roff_meta *);
static void print_bvspace(struct termp *,
const struct roff_node *, int);
@@ -139,7 +141,7 @@ void
terminal_man(void *arg, const struct man *man)
{
struct termp *p;
- const struct man_meta *meta;
+ const struct roff_meta *meta;
struct roff_node *n;
struct mtermp mt;
@@ -1012,13 +1014,11 @@ print_man_nodelist(DECL_ARGS)
}
static void
-print_man_foot(struct termp *p, const void *arg)
+print_man_foot(struct termp *p, const struct roff_meta *meta)
{
- const struct man_meta *meta;
char *title;
size_t datelen, titlen;
- meta = (const struct man_meta *)arg;
assert(meta->title);
assert(meta->msec);
assert(meta->date);
@@ -1030,8 +1030,8 @@ print_man_foot(struct termp *p, const void *arg)
/*
* Temporary, undocumented option to imitate mdoc(7) output.
- * In the bottom right corner, use the source instead of
- * the title.
+ * In the bottom right corner, use the operating system
+ * instead of the title.
*/
if ( ! p->mdocstyle) {
@@ -1041,14 +1041,14 @@ print_man_foot(struct termp *p, const void *arg)
}
mandoc_asprintf(&title, "%s(%s)",
meta->title, meta->msec);
- } else if (meta->source) {
- title = mandoc_strdup(meta->source);
+ } else if (meta->os) {
+ title = mandoc_strdup(meta->os);
} else {
title = mandoc_strdup("");
}
datelen = term_strlen(p, meta->date);
- /* Bottom left corner: manual source. */
+ /* Bottom left corner: operating system. */
p->flags |= TERMP_NOSPACE | TERMP_NOBREAK;
p->trailspace = 1;
@@ -1056,8 +1056,8 @@ print_man_foot(struct termp *p, const void *arg)
p->rmargin = p->maxrmargin > datelen ?
(p->maxrmargin + term_len(p, 1) - datelen) / 2 : 0;
- if (meta->source)
- term_word(p, meta->source);
+ if (meta->os)
+ term_word(p, meta->os);
term_flushln(p);
/* At the bottom in the middle: manual date. */
@@ -1084,14 +1084,12 @@ print_man_foot(struct termp *p, const void *arg)
}
static void
-print_man_head(struct termp *p, const void *arg)
+print_man_head(struct termp *p, const struct roff_meta *meta)
{
- const struct man_meta *meta;
const char *volume;
char *title;
size_t vollen, titlen;
- meta = (const struct man_meta *)arg;
assert(meta->title);
assert(meta->msec);