diff options
author | 2020-04-24 12:02:33 +0000 | |
---|---|---|
committer | 2020-04-24 12:02:33 +0000 | |
commit | 1849b727a60f67043a27dc863e3f90e2dbb84dfe (patch) | |
tree | a125523ca4600295cc5a94e8ca0582a1d871427f /man_validate.c | |
parent | d75c48416eef7eb48487f6dc9a1bafa2c262b81c (diff) | |
download | mandoc-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 'man_validate.c')
-rw-r--r-- | man_validate.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/man_validate.c b/man_validate.c index 84fc4424..2069fadc 100644 --- a/man_validate.c +++ b/man_validate.c @@ -1,4 +1,4 @@ -/* $Id: man_validate.c,v 1.153 2020/04/18 20:40:10 schwarze Exp $ */ +/* $Id: man_validate.c,v 1.154 2020/04/24 12:02:33 schwarze Exp $ */ /* * Copyright (c) 2010, 2012-2020 Ingo Schwarze <schwarze@openbsd.org> * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> @@ -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); |