summaryrefslogtreecommitdiffstats
path: root/mdoc_man.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2017-02-06 03:44:58 +0000
committerIngo Schwarze <schwarze@openbsd.org>2017-02-06 03:44:58 +0000
commitd7a5b4c3c2f2f5da253943d18545b97fafd28a49 (patch)
treebe80dcc927f48bf2ab10656d1e0e10d0e32919c8 /mdoc_man.c
parent4e045795c0b9e4b7f54bcb4057d3980e4dd9dfdf (diff)
downloadmandoc-d7a5b4c3c2f2f5da253943d18545b97fafd28a49.tar.gz
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 'mdoc_man.c')
-rw-r--r--mdoc_man.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/mdoc_man.c b/mdoc_man.c
index adb76b34..1d1f0f13 100644
--- a/mdoc_man.c
+++ b/mdoc_man.c
@@ -1518,7 +1518,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) {
@@ -1529,8 +1529,6 @@ pre_nm(DECL_ARGS)
outflags |= MMAN_nl;
}
font_push('B');
- if (NULL == n->child)
- print_word(meta->name);
return 1;
}
@@ -1544,7 +1542,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: