summaryrefslogtreecommitdiffstats
path: root/mansearch.c
diff options
context:
space:
mode:
Diffstat (limited to 'mansearch.c')
-rw-r--r--mansearch.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/mansearch.c b/mansearch.c
index 1d94937c..521f78de 100644
--- a/mansearch.c
+++ b/mansearch.c
@@ -352,6 +352,14 @@ mansearch(const struct mansearch *search,
sqlite3_finalize(s2);
sqlite3_close(db);
ohash_delete(&htab);
+
+ /*
+ * In man(1) mode, prefer matches in earlier trees
+ * over matches in later trees.
+ */
+
+ if (cur && search->firstmatch)
+ break;
}
qsort(*res, cur, sizeof(struct manpage), manpage_compare);
rc = 1;