summaryrefslogtreecommitdiffstats
path: root/mdoc_term.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2010-06-10 23:24:37 +0000
committerIngo Schwarze <schwarze@openbsd.org>2010-06-10 23:24:37 +0000
commit54c0fe4b66b6f28b69d70293f915b255af598960 (patch)
tree098fa67561a5cf2eec5708b6ee89bf1f881648fe /mdoc_term.c
parent92fc4a31da7eb79879434d883684209266ac3ff2 (diff)
downloadmandoc-54c0fe4b66b6f28b69d70293f915b255af598960.tar.gz
Fix a regression that crept in in man_term.c 1.73 and mdoc_term.c 1.144.
When the title line uses special characters, mandoc will segfault. Thus, first set up the character tables, then print the header, as we always did. Found in OpenBSD /usr/src/usr.sbin/bind/bin/check/named-checkconf.8. While here, set p->tabwidth in terminal_man() for symmetry with terminal_mdoc(), as suggested by millert@ (and already committed to OpenBSD earlier). Since 5 is the default, this is not strictly required, but it is certainly clearer and more robust. "looks fine" kristaps@
Diffstat (limited to 'mdoc_term.c')
-rw-r--r--mdoc_term.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/mdoc_term.c b/mdoc_term.c
index 35c169d6..b9c61d01 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -276,9 +276,6 @@ terminal_mdoc(void *arg, const struct mdoc *mdoc)
p->maxrmargin = p->defrmargin;
p->tabwidth = 5;
- term_begin(p, print_mdoc_head,
- print_mdoc_foot, mdoc_meta(mdoc));
-
if (NULL == p->symtab)
switch (p->enc) {
case (TERMENC_ASCII):
@@ -292,6 +289,8 @@ terminal_mdoc(void *arg, const struct mdoc *mdoc)
n = mdoc_node(mdoc);
m = mdoc_meta(mdoc);
+ term_begin(p, print_mdoc_head, print_mdoc_foot, m);
+
if (n->child)
print_mdoc_nodelist(p, NULL, m, n->child);