summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2018-11-22 12:01:43 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2018-11-22 12:01:43 +0000
commit98506a79907d20734fc46c9bcf8afbed155bdba9 (patch)
tree9921af97f1eca39149b025c3e8a4de1d48cbcab3 /usr.bin/mandoc
parent2d2bcd1c55e5386734cf4093ed896e8b53a4e29e (diff)
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.
Diffstat (limited to 'usr.bin/mandoc')
-rw-r--r--usr.bin/mandoc/main.c4
-rw-r--r--usr.bin/mandoc/mansearch.c10
-rw-r--r--usr.bin/mandoc/mansearch.h3
3 files changed, 5 insertions, 12 deletions
diff --git a/usr.bin/mandoc/main.c b/usr.bin/mandoc/main.c
index 558dfc43adf..a30037230c3 100644
--- a/usr.bin/mandoc/main.c
+++ b/usr.bin/mandoc/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.212 2018/11/22 11:30:15 schwarze Exp $ */
+/* $OpenBSD: main.c,v 1.213 2018/11/22 12:01:42 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2012, 2014-2018 Ingo Schwarze <schwarze@openbsd.org>
@@ -377,7 +377,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++;
@@ -724,7 +723,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/usr.bin/mandoc/mansearch.c b/usr.bin/mandoc/mansearch.c
index bbb2b664939..324e7358eef 100644
--- a/usr.bin/mandoc/mansearch.c
+++ b/usr.bin/mandoc/mansearch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mansearch.c,v 1.61 2018/11/19 19:27:29 schwarze Exp $ */
+/* $OpenBSD: mansearch.c,v 1.62 2018/11/22 12:01:42 schwarze Exp $ */
/*
* Copyright (c) 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013-2018 Ingo Schwarze <schwarze@openbsd.org>
@@ -198,7 +198,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;
@@ -293,10 +292,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);
@@ -409,8 +406,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/usr.bin/mandoc/mansearch.h b/usr.bin/mandoc/mansearch.h
index fc82c3f3309..d05ece1e050 100644
--- a/usr.bin/mandoc/mansearch.h
+++ b/usr.bin/mandoc/mansearch.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mansearch.h,v 1.22 2017/04/17 20:04:26 schwarze Exp $ */
+/* $OpenBSD: mansearch.h,v 1.23 2018/11/22 12:01:42 schwarze Exp $ */
/*
* Copyright (c) 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013, 2014, 2016, 2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -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;
};