From 1849b727a60f67043a27dc863e3f90e2dbb84dfe Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Fri, 24 Apr 2020 12:02:33 +0000 Subject: 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@ --- man_validate.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'man_validate.c') 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 * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons @@ -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); -- cgit v1.2.3-56-ge451