summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mandoc.h1
-rw-r--r--mdoc_validate.c39
-rw-r--r--read.c1
3 files changed, 41 insertions, 0 deletions
diff --git a/mandoc.h b/mandoc.h
index 46a50be8..5d32d422 100644
--- a/mandoc.h
+++ b/mandoc.h
@@ -48,6 +48,7 @@ enum mandocerr {
MANDOCERR_MDOCDATE, /* Mdocdate found: Dd ... */
MANDOCERR_MDOCDATE_MISSING, /* Mdocdate missing: Dd ... */
+ MANDOCERR_ARCH_BAD, /* unknown architecture: Dt ... arch */
MANDOCERR_OS_ARG, /* operating system explicitly specified: Os ... */
MANDOCERR_RCS_MISSING, /* RCS id missing */
diff --git a/mdoc_validate.c b/mdoc_validate.c
index 3f5387f4..b9075d06 100644
--- a/mdoc_validate.c
+++ b/mdoc_validate.c
@@ -1786,7 +1786,29 @@ post_sm(POST_ARGS)
static void
post_root(POST_ARGS)
{
+ const char *openbsd_arch[] = {
+ "alpha", "amd64", "arm64", "armv7", "hppa", "i386",
+ "landisk", "loongson", "luna88k", "macppc", "mips64",
+ "octeon", "sgi", "socppc", "sparc64", NULL
+ };
+ const char *netbsd_arch[] = {
+ "acorn26", "acorn32", "algor", "alpha", "amiga",
+ "arc", "atari",
+ "bebox", "cats", "cesfic", "cobalt", "dreamcast",
+ "emips", "evbarm", "evbmips", "evbppc", "evbsh3", "evbsh5",
+ "hp300", "hpcarm", "hpcmips", "hpcsh", "hppa",
+ "i386", "ibmnws", "luna68k",
+ "mac68k", "macppc", "mipsco", "mmeye", "mvme68k", "mvmeppc",
+ "netwinder", "news68k", "newsmips", "next68k",
+ "pc532", "playstation2", "pmax", "pmppc", "prep",
+ "sandpoint", "sbmips", "sgimips", "shark",
+ "sparc", "sparc64", "sun2", "sun3",
+ "vax", "walnut", "x68k", "x86", "x86_64", "xen", NULL
+ };
+ const char **arches[] = { NULL, netbsd_arch, openbsd_arch };
+
struct roff_node *n;
+ const char **arch;
/* Add missing prologue data. */
@@ -1813,6 +1835,23 @@ post_root(POST_ARGS)
mdoc->meta.os_e == MANDOC_OS_OPENBSD ?
"(OpenBSD)" : "(NetBSD)");
+ if (mdoc->meta.arch != NULL &&
+ (arch = arches[mdoc->meta.os_e]) != NULL) {
+ while (*arch != NULL && strcmp(*arch, mdoc->meta.arch))
+ arch++;
+ if (*arch == NULL) {
+ n = mdoc->first->child;
+ while (n->tok != MDOC_Dt)
+ n = n->next;
+ n = n->child->next->next;
+ mandoc_vmsg(MANDOCERR_ARCH_BAD,
+ mdoc->parse, n->line, n->pos,
+ "Dt ... %s %s", mdoc->meta.arch,
+ mdoc->meta.os_e == MANDOC_OS_OPENBSD ?
+ "(OpenBSD)" : "(NetBSD)");
+ }
+ }
+
/* Check that we begin with a proper `Sh'. */
n = mdoc->first->child;
diff --git a/read.c b/read.c
index 8f66f9ce..83f9da47 100644
--- a/read.c
+++ b/read.c
@@ -90,6 +90,7 @@ static const char * const mandocerrs[MANDOCERR_MAX] = {
"Mdocdate found",
"Mdocdate missing",
+ "unknown architecture",
"operating system explicitly specified",
"RCS id missing",