source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: Fix a regression that crept in in man_term.c 1.73 and
@ 2010-06-10 23:24 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2010-06-10 23:24 UTC (permalink / raw)
  To: source

Log Message:
-----------
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@

Modified Files:
--------------
    mdocml:
        man_term.c
        mdoc_term.c

Revision Data
-------------
Index: man_term.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/man_term.c,v
retrieving revision 1.74
retrieving revision 1.75
diff -Lman_term.c -Lman_term.c -u -p -r1.74 -r1.75
--- man_term.c
+++ man_term.c
@@ -158,8 +158,7 @@ terminal_man(void *arg, const struct man
 
 	p->overstep = 0;
 	p->maxrmargin = p->defrmargin;
-
-	term_begin(p, print_man_head, print_man_foot, man_meta(man));
+	p->tabwidth = 5;
 
 	if (NULL == p->symtab)
 		switch (p->enc) {
@@ -174,6 +173,7 @@ terminal_man(void *arg, const struct man
 	n = man_node(man);
 	m = man_meta(man);
 
+	term_begin(p, print_man_head, print_man_foot, m);
 	p->flags |= TERMP_NOSPACE;
 
 	mt.fl = 0;
Index: mdoc_term.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_term.c,v
retrieving revision 1.145
retrieving revision 1.146
diff -Lmdoc_term.c -Lmdoc_term.c -u -p -r1.145 -r1.146
--- mdoc_term.c
+++ mdoc_term.c
@@ -276,9 +276,6 @@ terminal_mdoc(void *arg, const struct md
 	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):
@@ -291,6 +288,8 @@ terminal_mdoc(void *arg, const struct md
 
 	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);
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-06-10 23:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-10 23:24 mdocml: Fix a regression that crept in in man_term.c 1.73 and schwarze

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).