source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: Save the manual type (mdoc, man, or cat) in the index file of
@ 2011-11-27 23:11 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2011-11-27 23:11 UTC (permalink / raw)
  To: source

Log Message:
-----------
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.

Modified Files:
--------------
    mdocml:
        apropos_db.c
        apropos_db.h
        mandocdb.c

Revision Data
-------------
Index: apropos_db.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/apropos_db.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -Lapropos_db.c -Lapropos_db.c -u -p -r1.13 -r1.14
--- apropos_db.c
+++ apropos_db.c
@@ -366,6 +366,7 @@ index_read(const DBT *key, const DBT *va
 	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);
Index: mandocdb.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mandocdb.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -Lmandocdb.c -Lmandocdb.c -u -p -r1.14 -r1.15
--- mandocdb.c
+++ mandocdb.c
@@ -592,6 +592,7 @@ index_merge(const struct of *of, struct 
 		 */
 
 		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);
Index: apropos_db.h
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/apropos_db.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -Lapropos_db.h -Lapropos_db.h -u -p -r1.9 -r1.10
--- apropos_db.h
+++ apropos_db.h
@@ -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.) */
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-11-27 23:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-27 23:11 mdocml: Save the manual type (mdoc, man, or cat) in the index file of schwarze

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).