aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--TODO8
-rw-r--r--main.c4
-rw-r--r--mansearch.c10
-rw-r--r--mansearch.h3
4 files changed, 13 insertions, 12 deletions
diff --git a/TODO b/TODO
index 4cc8414d..677b5a8d 100644
--- a/TODO
+++ b/TODO
@@ -1,6 +1,6 @@
************************************************************************
* Official mandoc TODO.
-* $Id: TODO,v 1.291 2019/04/23 11:43:24 schwarze Exp $
+* $Id: TODO,v 1.292 2019/04/30 18:51:57 schwarze Exp $
************************************************************************
Many issues are annotated for difficulty as follows:
@@ -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 b91c1586..bbc82bf9 100644
--- a/main.c
+++ b/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.322 2019/03/06 10:18:58 schwarze Exp $ */
+/* $Id: main.c,v 1.323 2019/04/30 18:51:57 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2012, 2014-2019 Ingo Schwarze <schwarze@openbsd.org>
@@ -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 0c457f95..19a55788 100644
--- a/mansearch.c
+++ b/mansearch.c
@@ -1,4 +1,4 @@
-/* $Id: mansearch.c,v 1.80 2018/12/13 11:55:46 schwarze Exp $ */
+/* $Id: mansearch.c,v 1.81 2019/04/30 18:51:57 schwarze Exp $ */
/*
* Copyright (c) 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013-2018 Ingo Schwarze <schwarze@openbsd.org>
@@ -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 355873f8..8a0aa121 100644
--- a/mansearch.h
+++ b/mansearch.h
@@ -1,4 +1,4 @@
-/* $Id: mansearch.h,v 1.29 2018/11/22 12:01:46 schwarze Exp $ */
+/* $Id: mansearch.h,v 1.30 2019/04/30 18:51:57 schwarze Exp $ */
/*
* Copyright (c) 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013, 2014, 2016, 2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -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;