summaryrefslogtreecommitdiffstats
path: root/mandocdb.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-04-19 02:56:54 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-04-19 02:56:54 +0000
commitc64d9ad4033a749b71419ced2dc27c0b4a787818 (patch)
treeb8ff4cbb8c6987bda8b638b77eae490c2b5eb64d /mandocdb.c
parent7ba711ac36ba8542cdb04d6e3e499c4304a94220 (diff)
downloadmandoc-c64d9ad4033a749b71419ced2dc27c0b4a787818.tar.gz
Two minor tweaks regarding the fallback from -u/-d to default mode:
(1) Use all files found on the command line, but do *not* use all stray files found during fallback tree recursion. (2) If the fallback works, call that success, i.e. exit(0). As pointed out by naddy@, the latter is required for ports' happiness.
Diffstat (limited to 'mandocdb.c')
-rw-r--r--mandocdb.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/mandocdb.c b/mandocdb.c
index 384f41f5..de0467a9 100644
--- a/mandocdb.c
+++ b/mandocdb.c
@@ -430,19 +430,20 @@ main(int argc, char *argv[])
ohash_init(&mlinks, 6, &mlinks_info);
if (OP_UPDATE == op || OP_DELETE == op || OP_TEST == op) {
- /*
- * Force processing all files.
- */
- use_all = 1;
/*
* All of these deal with a specific directory.
- * Jump into that directory then collect files specified
- * on the command-line.
+ * Jump into that directory first.
*/
if (0 == set_basedir(path_arg))
goto out;
+
if (dbopen(1)) {
+ /*
+ * The existing database is usable. Process
+ * all files specified on the command-line.
+ */
+ use_all = 1;
for (i = 0; i < argc; i++)
filescan(argv[i]);
if (OP_TEST != op)
@@ -452,6 +453,7 @@ main(int argc, char *argv[])
* Database missing or corrupt.
* Recreate from scratch.
*/
+ exitcode = (int)MANDOCLEVEL_OK;
op = OP_DEFAULT;
if (0 == treescan())
goto out;