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.
-/* $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>
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);
-/* $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>
*
#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.) */
-/* $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>
*/
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);