summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2011-11-16 19:47:58 +0000
committerschwarze <schwarze@openbsd.org>2011-11-16 19:47:58 +0000
commita2cff342cf5ff1aed0c0be0be55a92caa7d6f459 (patch)
tree950d94eb8116e5608259fb48e561e2dba0ded660
parentremove unused functions (diff)
downloadwireguard-openbsd-a2cff342cf5ff1aed0c0be0be55a92caa7d6f459.tar.xz
wireguard-openbsd-a2cff342cf5ff1aed0c0be0be55a92caa7d6f459.zip
When processing .Sh HEAD, as soon as we know which section this is,
fix up the section attributes of the HEAD, it's parent BLOCK, and all its (text) children. This is required because the section attributes get set when each node is allocated, i.e. before processing the content of the node itself. Thus, the listed nodes got the section attribute of the preceding section. No need to fix up the BODY, all is fine there already. Found while implementing TYPE_Sh for mandocdb(8).
-rw-r--r--usr.bin/mandoc/mdoc_validate.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/usr.bin/mandoc/mdoc_validate.c b/usr.bin/mandoc/mdoc_validate.c
index 5fa030fa874..9d8827d4b97 100644
--- a/usr.bin/mandoc/mdoc_validate.c
+++ b/usr.bin/mandoc/mdoc_validate.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_validate.c,v 1.96 2011/10/16 12:18:32 schwarze Exp $ */
+/* $Id: mdoc_validate.c,v 1.97 2011/11/16 19:47:58 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2011 Ingo Schwarze <schwarze@openbsd.org>
@@ -1814,6 +1814,7 @@ static int
post_sh_head(POST_ARGS)
{
char buf[BUFSIZ];
+ struct mdoc_node *n;
enum mdoc_sec sec;
int c;
@@ -1847,6 +1848,10 @@ post_sh_head(POST_ARGS)
/* Mark our last section. */
mdoc->lastsec = sec;
+ mdoc->last->parent->sec = sec;
+ mdoc->last->sec = sec;
+ for (n = mdoc->last->child; n; n = n->next)
+ n->sec = sec;
/* We don't care about custom sections after this. */