summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-04-03 21:45:31 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-04-03 21:45:31 +0000
commit2ec6816f1cda38fe01c3503f57dd7fd1132045c1 (patch)
tree1ce8e6e62db74b805a08027046a6c3b8bb2deb51
parent2fcbd1967fefe0ad3a462b25726a0cbd7483bfd7 (diff)
downloadmandoc-2ec6816f1cda38fe01c3503f57dd7fd1132045c1.tar.gz
Instead of silently doing nothing at all,
warn and return non-zero when the manpath is empty, that is, when /etc/man.conf is non-existent or unreadable AND the environment variable MANPATH is unset or empty AND no directories were given on the command line. Inspired by the error handling in espie@'s makewhatis(8), except that one doesn't know about MANPATH.
-rw-r--r--mandocdb.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/mandocdb.c b/mandocdb.c
index 46b6c3b0..e4ece756 100644
--- a/mandocdb.c
+++ b/mandocdb.c
@@ -462,6 +462,11 @@ main(int argc, char *argv[])
} else
manpath_parse(&dirs, path_arg, NULL, NULL);
+ if (0 == dirs.sz) {
+ exitcode = (int)MANDOCLEVEL_BADARG;
+ say("", "Empty manpath");
+ }
+
/*
* First scan the tree rooted at a base directory, then
* build a new database and finally move it into place.