diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2014-11-11 19:04:55 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2014-11-11 19:04:55 +0000 |
commit | c0cfd0d601c1d58cab2a03234d79d564f7bfc104 (patch) | |
tree | b521ac81e76fc22b00567c8576d62d0208be61c5 /mansearch.c | |
parent | 2c056fc7a8960253aa0b87c88175cd8cbe51af40 (diff) | |
download | mandoc-c0cfd0d601c1d58cab2a03234d79d564f7bfc104.tar.gz |
In man(1) mode without -a, stop searching after the first manual tree
that contained at least one match in order to not prefer mdoc(1) from
ports over mdoc(7). As a bonus, this results in a speedup.
Diffstat (limited to 'mansearch.c')
-rw-r--r-- | mansearch.c | 8 |
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; |