diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2017-06-24 18:58:33 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2017-06-24 18:58:33 +0000 |
commit | 5c0ccf0b9c80e147c37ca8e8bd3039518b494c34 (patch) | |
tree | 14d35e5b5df4c9fac627fc0395376b98c64e72ea /mdoc_validate.c | |
parent | 74844fe9be9fb35fad14e3d3a88057a81b006521 (diff) | |
download | mandoc-5c0ccf0b9c80e147c37ca8e8bd3039518b494c34.tar.gz |
operating system dependent message about unknown architecture;
inspired by mdoclint
Diffstat (limited to 'mdoc_validate.c')
-rw-r--r-- | mdoc_validate.c | 39 |
1 files changed, 39 insertions, 0 deletions
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; |