summaryrefslogtreecommitdiffstats
path: root/usr.bin/mandoc/mdoc_man.c
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2017-02-06 03:41:44 +0000
committerschwarze <schwarze@openbsd.org>2017-02-06 03:41:44 +0000
commit90957cf573bc3ab94ba9843c53f19dcfc4a49875 (patch)
treeb568646027e2416695ef9385e6373f908b0277f8 /usr.bin/mandoc/mdoc_man.c
parentDocument the behavior of -Wshadow. Add arm to the list of PIE archs (diff)
downloadwireguard-openbsd-90957cf573bc3ab94ba9843c53f19dcfc4a49875.tar.xz
wireguard-openbsd-90957cf573bc3ab94ba9843c53f19dcfc4a49875.zip
The .Nm macro does not only use the default name when it has no
argument, but also when the first argument is a child macro. Arcane issue found in the FreeBSD cxgbetool(8) manual that Baptiste Daroussin <bapt at FreeBSD> sent me long ago for a different reason. While solving this, switch to the new technique of doing text production in the validator, reducing code duplication in the formatters, which also makes -Ttree output clearer.
Diffstat (limited to 'usr.bin/mandoc/mdoc_man.c')
-rw-r--r--usr.bin/mandoc/mdoc_man.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/usr.bin/mandoc/mdoc_man.c b/usr.bin/mandoc/mdoc_man.c
index eb20830536a..4712ef0d78f 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.99 2017/01/11 17:39:45 schwarze Exp $ */
+/* $OpenBSD: mdoc_man.c,v 1.100 2017/02/06 03:41:44 schwarze Exp $ */
/*
* Copyright (c) 2011-2017 Ingo Schwarze <schwarze@openbsd.org>
*
@@ -1516,7 +1516,7 @@ pre_nm(DECL_ARGS)
}
if (n->type != ROFFT_ELEM && n->type != ROFFT_HEAD)
return 1;
- name = n->child ? n->child->string : meta->name;
+ name = n->child == NULL ? NULL : n->child->string;
if (NULL == name)
return 0;
if (n->type == ROFFT_HEAD) {
@@ -1527,8 +1527,6 @@ pre_nm(DECL_ARGS)
outflags |= MMAN_nl;
}
font_push('B');
- if (NULL == n->child)
- print_word(meta->name);
return 1;
}
@@ -1542,7 +1540,7 @@ post_nm(DECL_ARGS)
break;
case ROFFT_HEAD:
case ROFFT_ELEM:
- if (n->child != NULL || meta->name != NULL)
+ if (n->child != NULL && n->child->string != NULL)
font_pop();
break;
default: