source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: schwarze@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: mdocml: Fix a regression that crept in in man_term.c 1.73 and
Date: Thu, 10 Jun 2010 19:24:37 -0400 (EDT)	[thread overview]
Message-ID: <201006102324.o5ANObGm012243@krisdoz.my.domain> (raw)

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

                 reply	other threads:[~2010-06-10 23:24 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201006102324.o5ANObGm012243@krisdoz.my.domain \
    --to=schwarze@mdocml.bsd.lv \
    --cc=source@mdocml.bsd.lv \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).