From: kristaps@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: mdocml: Let apropos_db.h export the volume of manpages for a parsed
Date: Wed, 23 Nov 2011 04:55:28 -0500 (EST) [thread overview]
Message-ID: <201111230955.pAN9tSDe015610@krisdoz.my.domain> (raw)
Log Message:
-----------
Let apropos_db.h export the volume of manpages for a parsed record.
This is necessary since an array of records can have duplicate record
numbers in different mandoc.index files.
The volume [right now] is just the index of the parsed mandoc.index in
the manpaths. This is sensible because the order of the manpath is
significant (it's the order of duplicate-named manuals displayed by
man(1)) and is thus not likely to change.
Modified Files:
--------------
mdocml:
apropos_db.c
apropos_db.h
Revision Data
-------------
Index: apropos_db.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/apropos_db.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -Lapropos_db.c -Lapropos_db.c -u -p -r1.10 -r1.11
--- apropos_db.c
+++ apropos_db.c
@@ -125,7 +125,7 @@ static int exprmark(const struct expr *
static struct expr *exprexpr(int, char *[], int *, int *, size_t *);
static struct expr *exprterm(char *, int);
static DB *index_open(void);
-static int index_read(const DBT *, const DBT *,
+static int index_read(const DBT *, const DBT *, int,
const struct mchars *, struct rec *);
static void norm_string(const char *,
const struct mchars *, char **);
@@ -133,7 +133,7 @@ static size_t norm_utf8(unsigned int, c
static void recfree(struct rec *);
static int single_search(struct rectree *, const struct opts *,
const struct expr *, size_t terms,
- struct mchars *);
+ struct mchars *, int);
/*
* Open the keyword mandoc-db database.
@@ -345,7 +345,7 @@ index_open(void)
* Returns 1 if an entry was unpacked, 0 if the database is insane.
*/
static int
-index_read(const DBT *key, const DBT *val,
+index_read(const DBT *key, const DBT *val, int index,
const struct mchars *mc, struct rec *rec)
{
size_t left;
@@ -364,6 +364,7 @@ index_read(const DBT *key, const DBT *va
cp = (char *)val->data;
rec->res.rec = *(recno_t *)key->data;
+ rec->res.volume = index;
INDEX_BREAD(rec->res.file);
INDEX_BREAD(rec->res.cat);
@@ -402,7 +403,7 @@ apropos_search(int pathsz, char **paths,
for (i = 0; i < pathsz; i++) {
if (chdir(paths[i]))
continue;
- if ( ! single_search(&tree, opts, expr, terms, mc))
+ if ( ! single_search(&tree, opts, expr, terms, mc, i))
goto out;
}
@@ -438,7 +439,7 @@ out:
static int
single_search(struct rectree *tree, const struct opts *opts,
const struct expr *expr, size_t terms,
- struct mchars *mc)
+ struct mchars *mc, int vol)
{
int root, leaf, ch;
uint64_t mask;
@@ -525,7 +526,7 @@ single_search(struct rectree *tree, cons
break;
r.lhs = r.rhs = -1;
- if ( ! index_read(&key, &val, mc, &r))
+ if ( ! index_read(&key, &val, vol, mc, &r))
break;
/* XXX: this should be elsewhere, I guess? */
Index: apropos_db.h
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/apropos_db.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -Lapropos_db.h -Lapropos_db.h -u -p -r1.6 -r1.7
--- apropos_db.h
+++ apropos_db.h
@@ -24,6 +24,11 @@ struct res {
char *arch; /* arch (or empty string) */
char *desc; /* description (from Nd) */
unsigned int rec; /* record in index */
+ /*
+ * The index volume. This indexes into the array of directories
+ * searched for manual page databases.
+ */
+ unsigned int volume;
};
struct opts {
--
To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv
reply other threads:[~2011-11-23 9:55 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201111230955.pAN9tSDe015610@krisdoz.my.domain \
--to=kristaps@mdocml.bsd.lv \
--cc=source@mdocml.bsd.lv \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).