summaryrefslogtreecommitdiffstats
path: root/usr.bin/mandoc/man_validate.c
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2020-04-24 11:58:02 +0000
committerschwarze <schwarze@openbsd.org>2020-04-24 11:58:02 +0000
commitee646987ad381c980b1894eff0a3a59ee9762f4e (patch)
tree18dcf3c5bd8f1ca6648d6407767096d602c40ad0 /usr.bin/mandoc/man_validate.c
parentstrip trailing CRs at smtp level rather than io level (diff)
downloadwireguard-openbsd-ee646987ad381c980b1894eff0a3a59ee9762f4e.tar.xz
wireguard-openbsd-ee646987ad381c980b1894eff0a3a59ee9762f4e.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 'usr.bin/mandoc/man_validate.c')
-rw-r--r--usr.bin/mandoc/man_validate.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/usr.bin/mandoc/man_validate.c b/usr.bin/mandoc/man_validate.c
index 023a81e0efd..49aa3902d36 100644
--- a/usr.bin/mandoc/man_validate.c
+++ b/usr.bin/mandoc/man_validate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: man_validate.c,v 1.123 2020/04/18 20:28:46 schwarze Exp $ */
+/* $OpenBSD: man_validate.c,v 1.124 2020/04/24 11:58:02 schwarze Exp $ */
/*
* Copyright (c) 2010, 2012-2020 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -508,9 +508,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);