summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2018-11-22 12:01:46 +0000
committerIngo Schwarze <schwarze@openbsd.org>2018-11-22 12:01:46 +0000
commit1ac47583c44066590d7952c4e31d4b736ae27fca (patch)
tree23faf4a1830eca86e99dde5277bf6777312bb705
parent22da865402a78266a769c6c501dbecec806fc0d3 (diff)
downloadmandoc-1ac47583c44066590d7952c4e31d4b736ae27fca.tar.gz
In apropos(1) output, stop sorting .Nm search results by name
priorities (bits). The obscure feature wasn't documented and merely confused people - for example Edward Tomasz Napierala <trasz at FreeBSD>, see https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=227408. Smaller patch provided by Yuri Pankov <yuripv at FreeBSD>, but i'm also retiring the now unused "bits" member from struct manpage. Simplification is good.
-rw-r--r--main.c2
-rw-r--r--mansearch.c8
-rw-r--r--mansearch.h1
3 files changed, 2 insertions, 9 deletions
diff --git a/main.c b/main.c
index ad85efd6..8dee0ab1 100644
--- a/main.c
+++ b/main.c
@@ -405,7 +405,6 @@ main(int argc, char *argv[])
res[sz].names = NULL;
res[sz].output = NULL;
res[sz].ipath = SIZE_MAX;
- res[sz].bits = 0;
res[sz].sec = 10;
res[sz].form = FORM_SRC;
sz++;
@@ -754,7 +753,6 @@ found:
page->names = NULL;
page->output = NULL;
page->ipath = ipath;
- page->bits = NAME_FILE & NAME_MASK;
page->sec = (*sec >= '1' && *sec <= '9') ? *sec - '1' + 1 : 10;
page->form = form;
return 1;
diff --git a/mansearch.c b/mansearch.c
index 7ac8bcd2..d1552dc4 100644
--- a/mansearch.c
+++ b/mansearch.c
@@ -201,7 +201,6 @@ mansearch(const struct mansearch *search,
mpage->names = buildnames(page);
mpage->output = buildoutput(outkey, page);
mpage->ipath = i;
- mpage->bits = rp->bits;
mpage->sec = *page->sect - '0';
if (mpage->sec < 0 || mpage->sec > 9)
mpage->sec = 10;
@@ -296,10 +295,8 @@ manmerge_term(struct expr *e, struct ohash *htab)
break;
slot = ohash_lookup_memory(htab,
(char *)&res, sizeof(res.page), res.page);
- if ((rp = ohash_find(htab, slot)) != NULL) {
- rp->bits |= res.bits;
+ if ((rp = ohash_find(htab, slot)) != NULL)
continue;
- }
rp = mandoc_malloc(sizeof(*rp));
*rp = res;
ohash_insert(htab, slot, rp);
@@ -412,8 +409,7 @@ manpage_compare(const void *vp1, const void *vp2)
mp1 = vp1;
mp2 = vp2;
- if ((diff = mp2->bits - mp1->bits) ||
- (diff = mp1->sec - mp2->sec))
+ if ((diff = mp1->sec - mp2->sec))
return diff;
/* Fall back to alphabetic ordering of names. */
diff --git a/mansearch.h b/mansearch.h
index d18c226d..81d9d134 100644
--- a/mansearch.h
+++ b/mansearch.h
@@ -93,7 +93,6 @@ struct manpage {
char *names; /* a list of names with sections */
char *output; /* user-defined additional output */
size_t ipath; /* number of the manpath */
- uint64_t bits; /* name type mask */
int sec; /* section number, 10 means invalid */
enum form form;
};