summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc/main.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2019-03-04 13:01:53 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2019-03-04 13:01:53 +0000
commit3d0ae15b738b91538f9b5b8ab024a3c8c0598a99 (patch)
treed389d7073e228160965c747e765532716c5fbfa7 /usr.bin/mandoc/main.c
parent4c84aa76ac41e6a49ebe3e7c66cf37475c40e604 (diff)
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 'usr.bin/mandoc/main.c')
-rw-r--r--usr.bin/mandoc/main.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.bin/mandoc/main.c b/usr.bin/mandoc/main.c
index 2db236a256e..6eb8a620f01 100644
--- a/usr.bin/mandoc/main.c
+++ b/usr.bin/mandoc/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.222 2019/03/03 13:01:47 schwarze Exp $ */
+/* $OpenBSD: main.c,v 1.223 2019/03/04 13:01:52 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2012, 2014-2019 Ingo Schwarze <schwarze@openbsd.org>
@@ -767,7 +767,11 @@ fs_search(const struct mansearch *cfg, const struct manpaths *paths,
}
if (res != NULL && *ressz == lastsz &&
strchr(*argv, '/') == NULL) {
- if (cfg->sec == NULL)
+ if (cfg->arch != NULL &&
+ arch_valid(cfg->arch, MANDOC_OS_OPENBSD) == 0)
+ warnx("Unknown architecture \"%s\".",
+ cfg->arch);
+ else if (cfg->sec == NULL)
warnx("No entry for %s in the manual.",
*argv);
else