diff options
author | 2020-04-24 11:58:02 +0000 | |
---|---|---|
committer | 2020-04-24 11:58:02 +0000 | |
commit | ee646987ad381c980b1894eff0a3a59ee9762f4e (patch) | |
tree | 18dcf3c5bd8f1ca6648d6407767096d602c40ad0 /usr.bin/mandoc/man_validate.c | |
parent | strip trailing CRs at smtp level rather than io level (diff) | |
download | wireguard-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.c | 11 |
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); |