aboutsummaryrefslogtreecommitdiffstatshomepage
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
commita70f21c0692d63a23e666b09912d21d50f61f0cb (patch)
tree1af950fd45e8960526ae05ff29dbcbce612efd50 /man_validate.c
parent5ade79f1a4ef39ab8eb8088ec66210650561d148 (diff)
downloadmandoc-a70f21c0692d63a23e666b09912d21d50f61f0cb.tar.gz
mandoc-a70f21c0692d63a23e666b09912d21d50f61f0cb.tar.zst
mandoc-a70f21c0692d63a23e666b09912d21d50f61f0cb.zip
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. */