source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: Instead of silently doing nothing at all, warn and return
@ 2014-04-03 21:45 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2014-04-03 21:45 UTC (permalink / raw)
  To: source

Log Message:
-----------
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.

Modified Files:
--------------
    mdocml:
        mandocdb.c

Revision Data
-------------
Index: mandocdb.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mandocdb.c,v
retrieving revision 1.126
retrieving revision 1.127
diff -Lmandocdb.c -Lmandocdb.c -u -p -r1.126 -r1.127
--- mandocdb.c
+++ 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.
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-04-03 21:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-03 21:45 mdocml: Instead of silently doing nothing at all, warn and return schwarze

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).