summaryrefslogtreecommitdiffstats
path: root/usr.bin/mandoc/mdoc_man.c
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2018-12-30 00:48:47 +0000
committerschwarze <schwarze@openbsd.org>2018-12-30 00:48:47 +0000
commit6b86842e6cdb3960f6b08bd377e1a60a2f8ba124 (patch)
tree50673084d24eb85a3039a769d815803000c6565f /usr.bin/mandoc/mdoc_man.c
parentCleanup: Initialize the pointers to position data early, and use (diff)
downloadwireguard-openbsd-6b86842e6cdb3960f6b08bd377e1a60a2f8ba124.tar.xz
wireguard-openbsd-6b86842e6cdb3960f6b08bd377e1a60a2f8ba124.zip
Cleanup, no functional change:
The struct roff_man used to be a bad mixture of internal parser state and public parsing results. Move the public results to the parsing result struct roff_meta, which is already public. Move the rest of struct roff_man to the parser-internal header roff_int.h. Since the validators need access to the parser state, call them from the top level parser during mparse_result() rather than from the main programs, also reducing code duplication. This keeps parser internal state out of thee main programs (five in mandoc portable) and out of eight formatters.
Diffstat (limited to 'usr.bin/mandoc/mdoc_man.c')
-rw-r--r--usr.bin/mandoc/mdoc_man.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/usr.bin/mandoc/mdoc_man.c b/usr.bin/mandoc/mdoc_man.c
index 17446b70f2a..a573de7f108 100644
--- a/usr.bin/mandoc/mdoc_man.c
+++ b/usr.bin/mandoc/mdoc_man.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mdoc_man.c,v 1.128 2018/12/15 19:30:19 schwarze Exp $ */
+/* $OpenBSD: mdoc_man.c,v 1.129 2018/12/30 00:48:48 schwarze Exp $ */
/*
* Copyright (c) 2011-2018 Ingo Schwarze <schwarze@openbsd.org>
*
@@ -600,7 +600,7 @@ print_count(int *count)
}
void
-man_mdoc(void *arg, const struct roff_man *mdoc)
+man_mdoc(void *arg, const struct roff_meta *mdoc)
{
struct roff_node *n;
@@ -613,9 +613,8 @@ man_mdoc(void *arg, const struct roff_man *mdoc)
}
printf(".TH \"%s\" \"%s\" \"%s\" \"%s\" \"%s\"\n",
- mdoc->meta.title,
- (mdoc->meta.msec == NULL ? "" : mdoc->meta.msec),
- mdoc->meta.date, mdoc->meta.os, mdoc->meta.vol);
+ mdoc->title, (mdoc->msec == NULL ? "" : mdoc->msec),
+ mdoc->date, mdoc->os, mdoc->vol);
/* Disable hyphenation and if nroff, disable justification. */
printf(".nh\n.if n .ad l");
@@ -627,7 +626,7 @@ man_mdoc(void *arg, const struct roff_man *mdoc)
*fontqueue.tail = 'R';
}
for (; n != NULL; n = n->next)
- print_node(&mdoc->meta, n);
+ print_node(mdoc, n);
putchar('\n');
}