diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2017-06-24 14:38:32 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2017-06-24 14:38:32 +0000 |
commit | a70f21c0692d63a23e666b09912d21d50f61f0cb (patch) | |
tree | 1af950fd45e8960526ae05ff29dbcbce612efd50 /mdoc_validate.c | |
parent | 5ade79f1a4ef39ab8eb8088ec66210650561d148 (diff) | |
download | mandoc-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 'mdoc_validate.c')
-rw-r--r-- | mdoc_validate.c | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/mdoc_validate.c b/mdoc_validate.c index 24d8789a..67f1525f 100644 --- a/mdoc_validate.c +++ b/mdoc_validate.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_validate.c,v 1.339 2017/06/17 22:43:14 schwarze Exp $ */ +/* $Id: mdoc_validate.c,v 1.340 2017/06/24 14:38:33 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2017 Ingo Schwarze <schwarze@openbsd.org> @@ -1709,7 +1709,7 @@ post_bl(POST_ARGS) nchild = nnext; } - if (mdoc->meta.os_e != MDOC_OS_NETBSD) + if (mdoc->meta.os_e != MANDOC_OS_NETBSD) return; prev_Er = NULL; @@ -1728,11 +1728,12 @@ post_bl(POST_ARGS) if (order > 0) mandoc_vmsg(MANDOCERR_ER_ORDER, mdoc->parse, nnext->line, nnext->pos, - "Er %s %s", prev_Er, nnext->string); + "Er %s %s (NetBSD)", + prev_Er, nnext->string); else if (order == 0) mandoc_vmsg(MANDOCERR_ER_REP, mdoc->parse, nnext->line, nnext->pos, - "Er %s", prev_Er); + "Er %s (NetBSD)", prev_Er); } prev_Er = nnext->string; } @@ -1808,8 +1809,9 @@ post_root(POST_ARGS) mdoc->meta.os = mandoc_strdup(""); } else if (mdoc->meta.os_e && (mdoc->meta.rcsids & (1 << mdoc->meta.os_e)) == 0) - mandoc_msg(MANDOCERR_RCS_MISSING, - mdoc->parse, 0, 0, NULL); + mandoc_msg(MANDOCERR_RCS_MISSING, mdoc->parse, 0, 0, + mdoc->meta.os_e == MANDOC_OS_OPENBSD ? + "(OpenBSD)" : "(NetBSD)"); /* Check that we begin with a proper `Sh'. */ @@ -2548,8 +2550,8 @@ post_os(POST_ARGS) if (mdoc->meta.os) goto out; - if (mdoc->defos) { - mdoc->meta.os = mandoc_strdup(mdoc->defos); + if (mdoc->os_s != NULL) { + mdoc->meta.os = mandoc_strdup(mdoc->os_s); goto out; } @@ -2568,9 +2570,13 @@ post_os(POST_ARGS) mdoc->meta.os = mandoc_strdup(defbuf); #endif /*!OSNAME*/ -out: mdoc->meta.os_e = strstr(mdoc->meta.os, "OpenBSD") != NULL ? - MDOC_OS_OPENBSD : strstr(mdoc->meta.os, "NetBSD") != NULL ? - MDOC_OS_NETBSD : MDOC_OS_OTHER; +out: + if (mdoc->meta.os_e == MANDOC_OS_OTHER) { + if (strstr(mdoc->meta.os, "OpenBSD") != NULL) + mdoc->meta.os_e = MANDOC_OS_OPENBSD; + else if (strstr(mdoc->meta.os, "NetBSD") != NULL) + mdoc->meta.os_e = MANDOC_OS_NETBSD; + } /* * This is the earliest point where we can check @@ -2584,15 +2590,15 @@ out: mdoc->meta.os_e = strstr(mdoc->meta.os, "OpenBSD") != NULL ? if ((n = n->child) == NULL) return; if (strncmp(n->string, "$" "Mdocdate", 9)) { - if (mdoc->meta.os_e == MDOC_OS_OPENBSD) + if (mdoc->meta.os_e == MANDOC_OS_OPENBSD) mandoc_vmsg(MANDOCERR_MDOCDATE_MISSING, mdoc->parse, n->line, n->pos, - "Dd %s", n->string); + "Dd %s (OpenBSD)", n->string); } else { - if (mdoc->meta.os_e == MDOC_OS_NETBSD) + if (mdoc->meta.os_e == MANDOC_OS_NETBSD) mandoc_vmsg(MANDOCERR_MDOCDATE, mdoc->parse, n->line, n->pos, - "Dd %s", n->string); + "Dd %s (NetBSD)", n->string); } } |