aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mandocdb.c
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
commitdc91be3095306ef1c3a2917e20da4f98dbd6291e (patch)
treec8fc7e8db0691de677b03b94509fcc0f067341a1 /mandocdb.c
parent12d97e930f816d7505ce9bf1b1065b89a2b0d850 (diff)
downloadmandoc-dc91be3095306ef1c3a2917e20da4f98dbd6291e.tar.gz
mandoc-dc91be3095306ef1c3a2917e20da4f98dbd6291e.tar.zst
mandoc-dc91be3095306ef1c3a2917e20da4f98dbd6291e.zip
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.
Diffstat (limited to 'mandocdb.c')
-rw-r--r--mandocdb.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/mandocdb.c b/mandocdb.c
index 6e61c149..5ce63bcb 100644
--- a/mandocdb.c
+++ b/mandocdb.c
@@ -1,4 +1,4 @@
-/* $Id: mandocdb.c,v 1.126 2014/04/03 16:27:28 schwarze Exp $ */
+/* $Id: mandocdb.c,v 1.127 2014/04/03 21:45:31 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -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.