summaryrefslogtreecommitdiffstats
path: root/man_validate.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2020-04-24 12:02:33 +0000
committerIngo Schwarze <schwarze@openbsd.org>2020-04-24 12:02:33 +0000
commit8cb870017a69040560be430c7f7978efa809acb3 (patch)
tree47f257f67a01e84b2f35c6e70b21c7c6bc3e9de8 /man_validate.c
parent2258889db3530de027ab40978bb09a8a824e9c5f (diff)
downloadmandoc-8cb870017a69040560be430c7f7978efa809acb3.tar.gz
provide a STYLE message when mandoc knows the file name and the extension
disagrees with the section number given in the .Dt or .TH macro; feature suggested and patch tested by jmc@
Diffstat (limited to 'man_validate.c')
-rw-r--r--man_validate.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/man_validate.c b/man_validate.c
index cb814217..da2f1ee7 100644
--- a/man_validate.c
+++ b/man_validate.c
@@ -510,9 +510,14 @@ post_TH(CHKARGS)
if (n != NULL)
n = n->next;
- if (n != NULL && n->string != NULL)
+ if (n != NULL && n->string != NULL) {
man->meta.msec = mandoc_strdup(n->string);
- else {
+ if (man->filesec != '\0' &&
+ man->filesec != *n->string &&
+ *n->string >= '1' && *n->string <= '9')
+ mandoc_msg(MANDOCERR_MSEC_FILE, n->line, n->pos,
+ "*.%c vs TH ... %c", man->filesec, *n->string);
+ } else {
man->meta.msec = mandoc_strdup("");
mandoc_msg(MANDOCERR_MSEC_MISSING,
nb->line, nb->pos, "TH %s", man->meta.title);