summaryrefslogtreecommitdiffstats
path: root/man_validate.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2017-06-24 14:38:32 +0000
committerIngo Schwarze <schwarze@openbsd.org>2017-06-24 14:38:32 +0000
commit07569d42d40c11c0305c5b07d2c1bbb04047c52f (patch)
tree0ca3f05c4302f6bc52990f37471deafaec85364e /man_validate.c
parent913045bd69043c5a0ba155b88f2ef24c6bcae97f (diff)
downloadmandoc-07569d42d40c11c0305c5b07d2c1bbb04047c52f.tar.gz
Split -Wstyle into -Wstyle and the even lower -Wbase, and add
-Wopenbsd and -Wnetbsd to check conventions for the base system of a specific operating system. Mark operating system specific messages with "(OpenBSD)" at the end. Please use just "-Tlint" to check base system manuals (defaulting to -Wall, which is now -Wbase), but prefer "-Tlint -Wstyle" for the manuals of portable software projects you maintain that are not part of OpenBSD base, to avoid bogus recommendations about base system conventions that do not apply. Issue originally reported by semarie@, solution using an idea from tedu@, discussed with jmc@ and jca@.
Diffstat (limited to 'man_validate.c')
-rw-r--r--man_validate.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/man_validate.c b/man_validate.c
index 7426bfbb..e874cabb 100644
--- a/man_validate.c
+++ b/man_validate.c
@@ -173,7 +173,9 @@ check_root(CHKARGS)
if (man->meta.os_e &&
(man->meta.rcsids & (1 << man->meta.os_e)) == 0)
- mandoc_msg(MANDOCERR_RCS_MISSING, man->parse, 0, 0, NULL);
+ mandoc_msg(MANDOCERR_RCS_MISSING, man->parse, 0, 0,
+ man->meta.os_e == MANDOC_OS_OPENBSD ?
+ "(OpenBSD)" : "(NetBSD)");
}
static void
@@ -340,12 +342,14 @@ post_TH(CHKARGS)
if (n && (n = n->next))
man->meta.os = mandoc_strdup(n->string);
- else if (man->defos != NULL)
- man->meta.os = mandoc_strdup(man->defos);
- man->meta.os_e = man->meta.os == NULL ? MDOC_OS_OTHER :
- strstr(man->meta.os, "OpenBSD") != NULL ? MDOC_OS_OPENBSD :
- strstr(man->meta.os, "NetBSD") != NULL ? MDOC_OS_NETBSD :
- MDOC_OS_OTHER;
+ else if (man->os_s != NULL)
+ man->meta.os = mandoc_strdup(man->os_s);
+ if (man->meta.os_e == MANDOC_OS_OTHER && man->meta.os != NULL) {
+ if (strstr(man->meta.os, "OpenBSD") != NULL)
+ man->meta.os_e = MANDOC_OS_OPENBSD;
+ else if (strstr(man->meta.os, "NetBSD") != NULL)
+ man->meta.os_e = MANDOC_OS_NETBSD;
+ }
/* TITLE MSEC DATE OS ->VOL<- */
/* If missing, use the default VOL name for MSEC. */