summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--TODO6
-rw-r--r--main.c2
-rw-r--r--mansearch.c8
-rw-r--r--mansearch.h1
4 files changed, 9 insertions, 8 deletions
diff --git a/TODO b/TODO
index 037ae01a..b45986eb 100644
--- a/TODO
+++ b/TODO
@@ -229,12 +229,6 @@ are mere guesses, and some may be wrong.
probably requires putting string version of section into struct manpage
loc * exist ** algo * size * imp ***
-- restore flags for result ordering, but only for man(1), not for apropos(1)
- such that man 3 syslog show syslog.3 not klogctl.3
- and such that man 3p acosl shows acosl.3p not acos.3p
- https://github.com/void-linux/void-packages/issues/9868
- loc * exist ** algo * size * imp ***
-
- dead .so links should be entered into the database to avoid:
man -M. lvm-config
man: outdated mandoc.db lacks lvm-config(8) entry, run makewhatis /co/void-man
diff --git a/main.c b/main.c
index 0f98a5fc..04fbe3e6 100644
--- a/main.c
+++ b/main.c
@@ -411,6 +411,7 @@ main(int argc, char *argv[])
res[sz].file = mandoc_strdup(argv[c]);
res[sz].names = NULL;
res[sz].output = NULL;
+ res[sz].bits = 0;
res[sz].ipath = SIZE_MAX;
res[sz].sec = 10;
res[sz].form = FORM_SRC;
@@ -761,6 +762,7 @@ found:
page->file = file;
page->names = NULL;
page->output = NULL;
+ page->bits = NAME_FILE & NAME_MASK;
page->ipath = ipath;
page->sec = (*sec >= '1' && *sec <= '9') ? *sec - '1' + 1 : 10;
page->form = form;
diff --git a/mansearch.c b/mansearch.c
index dfd1d39f..89601fde 100644
--- a/mansearch.c
+++ b/mansearch.c
@@ -199,6 +199,7 @@ 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->sec = *page->sect - '0';
if (mpage->sec < 0 || mpage->sec > 9)
@@ -294,8 +295,10 @@ 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)
+ if ((rp = ohash_find(htab, slot)) != NULL) {
+ rp->bits |= res.bits;
continue;
+ }
rp = mandoc_malloc(sizeof(*rp));
*rp = res;
ohash_insert(htab, slot, rp);
@@ -408,7 +411,8 @@ manpage_compare(const void *vp1, const void *vp2)
mp1 = vp1;
mp2 = vp2;
- if ((diff = mp1->sec - mp2->sec))
+ if ((diff = mp2->bits - mp1->bits) ||
+ (diff = mp1->sec - mp2->sec))
return diff;
/* Fall back to alphabetic ordering of names. */
diff --git a/mansearch.h b/mansearch.h
index 81d9d134..330d1c07 100644
--- a/mansearch.h
+++ b/mansearch.h
@@ -92,6 +92,7 @@ struct manpage {
char *file; /* to be prefixed by manpath */
char *names; /* a list of names with sections */
char *output; /* user-defined additional output */
+ uint64_t bits; /* name type mask */
size_t ipath; /* number of the manpath */
int sec; /* section number, 10 means invalid */
enum form form;