aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_validate.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2019-03-04 13:01:57 +0000
committerIngo Schwarze <schwarze@openbsd.org>2019-03-04 13:01:57 +0000
commitca708704fad0de6eaa3d24f35deead2fb4b5ebf7 (patch)
treecb2e255a750c123b475700630915a5a36e2c02f3 /mdoc_validate.c
parent04c83a367828561c8e5f8f4beb200e2978b5753c (diff)
downloadmandoc-ca708704fad0de6eaa3d24f35deead2fb4b5ebf7.tar.gz
mandoc-ca708704fad0de6eaa3d24f35deead2fb4b5ebf7.tar.zst
mandoc-ca708704fad0de6eaa3d24f35deead2fb4b5ebf7.zip
When the -S option is given to man(1) and the requested manual page
name is not found and the requested architecture is unknown, complain about the architecture rather than about the manual page name: $ man -S vax cpu man: Unknown architecture "vax". $ man -S sparc64 foobar man: No entry for foobar in the manual. Friendlier error message suggested by jmc@, who also OK'ed the patch.
Diffstat (limited to 'mdoc_validate.c')
-rw-r--r--mdoc_validate.c54
1 files changed, 14 insertions, 40 deletions
diff --git a/mdoc_validate.c b/mdoc_validate.c
index 448cc7ca..7d1575f2 100644
--- a/mdoc_validate.c
+++ b/mdoc_validate.c
@@ -1,7 +1,7 @@
-/* $Id: mdoc_validate.c,v 1.370 2019/03/04 11:40:09 schwarze Exp $ */
+/* $Id: mdoc_validate.c,v 1.371 2019/03/04 13:01:57 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2010-2018 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2010-2019 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2010 Joerg Sonnenberger <joerg@netbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
@@ -1898,29 +1898,7 @@ 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. */
@@ -1946,22 +1924,18 @@ post_root(POST_ARGS)
"(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->meta.first->child;
- while (n->tok != MDOC_Dt ||
- n->child == NULL ||
- n->child->next == NULL ||
- n->child->next->next == NULL)
- n = n->next;
- n = n->child->next->next;
- mandoc_msg(MANDOCERR_ARCH_BAD, n->line, n->pos,
- "Dt ... %s %s", mdoc->meta.arch,
- mdoc->meta.os_e == MANDOC_OS_OPENBSD ?
- "(OpenBSD)" : "(NetBSD)");
- }
+ arch_valid(mdoc->meta.arch, mdoc->meta.os_e) == 0) {
+ n = mdoc->meta.first->child;
+ while (n->tok != MDOC_Dt ||
+ n->child == NULL ||
+ n->child->next == NULL ||
+ n->child->next->next == NULL)
+ n = n->next;
+ n = n->child->next->next;
+ mandoc_msg(MANDOCERR_ARCH_BAD, 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'. */