aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2011-11-27 23:11:37 +0000
committerIngo Schwarze <schwarze@openbsd.org>2011-11-27 23:11:37 +0000
commit07304175d86315fbc89776525d955c80343d865e (patch)
tree555f9d14fa90e39cd3350e61f7c67d3e2762fd94
parent776f2786ee96823180362d9f454bfbe3737761ca (diff)
downloadmandoc-07304175d86315fbc89776525d955c80343d865e.tar.gz
mandoc-07304175d86315fbc89776525d955c80343d865e.tar.zst
mandoc-07304175d86315fbc89776525d955c80343d865e.zip
Save the manual type (mdoc, man, or cat) in the index file
of the mandoc databases, as suggested by kristaps@. Given the well-structured code, this is surprisingly simple. This changes the mandoc.index database format. Run "sudo mandocdb" to regenerate your databases.
-rw-r--r--apropos_db.c3
-rw-r--r--apropos_db.h3
-rw-r--r--mandocdb.c3
3 files changed, 6 insertions, 3 deletions
diff --git a/apropos_db.c b/apropos_db.c
index 4e41a22b..4a83a3bb 100644
--- a/apropos_db.c
+++ b/apropos_db.c
@@ -1,4 +1,4 @@
-/* $Id: apropos_db.c,v 1.13 2011/11/27 18:54:01 kristaps Exp $ */
+/* $Id: apropos_db.c,v 1.14 2011/11/27 23:11:37 schwarze Exp $ */
/*
* Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org>
@@ -366,6 +366,7 @@ index_read(const DBT *key, const DBT *val, int index,
rec->res.rec = *(recno_t *)key->data;
rec->res.volume = index;
+ INDEX_BREAD(rec->res.type);
INDEX_BREAD(rec->res.file);
INDEX_BREAD(rec->res.cat);
INDEX_BREAD(rec->res.title);
diff --git a/apropos_db.h b/apropos_db.h
index 8d03e5be..be48b063 100644
--- a/apropos_db.h
+++ b/apropos_db.h
@@ -1,4 +1,4 @@
-/* $Id: apropos_db.h,v 1.9 2011/11/27 18:54:01 kristaps Exp $ */
+/* $Id: apropos_db.h,v 1.10 2011/11/27 23:11:37 schwarze Exp $ */
/*
* Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -18,6 +18,7 @@
#define APROPOS_H
struct res {
+ char *type; /* file type: mdoc, man or cat */
char *file; /* file in file-system */
char *cat; /* category (3p, 3, etc.) */
char *title; /* title (FOO, etc.) */
diff --git a/mandocdb.c b/mandocdb.c
index a6b8bf05..1925389a 100644
--- a/mandocdb.c
+++ b/mandocdb.c
@@ -1,4 +1,4 @@
-/* $Id: mandocdb.c,v 1.14 2011/11/27 22:57:53 schwarze Exp $ */
+/* $Id: mandocdb.c,v 1.15 2011/11/27 23:11:37 schwarze Exp $ */
/*
* Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org>
@@ -592,6 +592,7 @@ index_merge(const struct of *of, struct mparse *mp,
*/
dbuf->len = 0;
+ buf_append(dbuf, mdoc ? "mdoc" : (man ? "man" : "cat"));
buf_appendb(dbuf, fn, strlen(fn) + 1);
buf_appendb(dbuf, msec, strlen(msec) + 1);
buf_appendb(dbuf, mtitle, strlen(mtitle) + 1);