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@ --- mdoc_validate.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'mdoc_validate.c') 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 * Copyright (c) 2008-2012 Kristaps Dzonsons @@ -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. */ -- cgit v1.2.3