summaryrefslogtreecommitdiffstats
path: root/mdoc_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 /mdoc_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 'mdoc_validate.c')
-rw-r--r--mdoc_validate.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/mdoc_validate.c b/mdoc_validate.c
index fa0ada83..95db41cb 100644
--- a/mdoc_validate.c
+++ b/mdoc_validate.c
@@ -2765,8 +2765,14 @@ post_dt(POST_ARGS)
mandoc_msg(MANDOCERR_MSEC_BAD,
nn->line, nn->pos, "Dt ... %s", nn->string);
mdoc->meta.vol = mandoc_strdup(nn->string);
- } else
+ } else {
mdoc->meta.vol = mandoc_strdup(cp);
+ if (mdoc->filesec != '\0' &&
+ mdoc->filesec != *nn->string &&
+ *nn->string >= '1' && *nn->string <= '9')
+ mandoc_msg(MANDOCERR_MSEC_FILE, nn->line, nn->pos,
+ "*.%c vs Dt ... %c", mdoc->filesec, *nn->string);
+ }
/* Optional third argument: architecture. */