aboutsummaryrefslogtreecommitdiffstatshomepage
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
commit1849b727a60f67043a27dc863e3f90e2dbb84dfe (patch)
treea125523ca4600295cc5a94e8ca0582a1d871427f /mdoc_validate.c
parentd75c48416eef7eb48487f6dc9a1bafa2c262b81c (diff)
downloadmandoc-1849b727a60f67043a27dc863e3f90e2dbb84dfe.tar.gz
mandoc-1849b727a60f67043a27dc863e3f90e2dbb84dfe.tar.zst
mandoc-1849b727a60f67043a27dc863e3f90e2dbb84dfe.zip
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.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/mdoc_validate.c b/mdoc_validate.c
index 129e4730..39c66b1f 100644
--- a/mdoc_validate.c
+++ b/mdoc_validate.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_validate.c,v 1.385 2020/04/18 20:40:10 schwarze Exp $ */
+/* $Id: mdoc_validate.c,v 1.386 2020/04/24 12:02:33 schwarze Exp $ */
/*
* Copyright (c) 2010-2020 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -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. */