=================================================================== RCS file: /cvs/mandoc/mansearch.c,v retrieving revision 1.78 retrieving revision 1.83 diff -u -p -r1.78 -r1.83 --- mandoc/mansearch.c 2018/11/19 19:27:37 1.78 +++ mandoc/mansearch.c 2022/01/13 04:06:16 1.83 @@ -1,4 +1,4 @@ -/* $Id: mansearch.c,v 1.78 2018/11/19 19:27:37 schwarze Exp $ */ +/* $Id: mansearch.c,v 1.83 2022/01/13 04:06:16 schwarze Exp $ */ /* * Copyright (c) 2012 Kristaps Dzonsons * Copyright (c) 2013-2018 Ingo Schwarze @@ -36,7 +36,6 @@ #include #include -#include "mandoc.h" #include "mandoc_aux.h" #include "mandoc_ohash.h" #include "manconf.h" @@ -192,7 +191,7 @@ mansearch(const struct mansearch *search, mpage->file, R_OK) == -1) { warn("%s", mpage->file); warnx("outdated mandoc.db contains " - "bogus %s entry, run makewhatis %s", + "bogus %s entry, run makewhatis %s", page->file + 1, paths->paths[i]); free(mpage->file); free(rp); @@ -200,8 +199,8 @@ mansearch(const struct mansearch *search, } mpage->names = buildnames(page); mpage->output = buildoutput(outkey, page); + mpage->bits = search->firstmatch ? rp->bits : 0; mpage->ipath = i; - mpage->bits = rp->bits; mpage->sec = *page->sect - '0'; if (mpage->sec < 0 || mpage->sec > 9) mpage->sec = 10; @@ -221,7 +220,7 @@ mansearch(const struct mansearch *search, if (cur && search->firstmatch) break; } - if (res != NULL) + if (res != NULL && cur > 1) qsort(*res, cur, sizeof(struct manpage), manpage_compare); if (chdir_status && getcwd_status && chdir(buf) == -1) warn("%s", buf);