From 58b2b9f4741e56383779973cc412ca087987b114 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Sun, 13 Nov 2011 10:49:57 +0000 Subject: Inventing new keywords for mostly the same thing when a well-established set of keywords already exists is a bad idea, so reuse the mdoc(7) macro names as apropos(1) search types. This is a gain in brevity as well. Some time ago, kristaps@ agreed in principle. The search type bit field constants are used by both mandocdb(8) and apropos(1) and should better stay in sync, so give them their own header file. --- apropos_db.c | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) (limited to 'apropos_db.c') diff --git a/apropos_db.c b/apropos_db.c index 8ec6130e..98ae214f 100644 --- a/apropos_db.c +++ b/apropos_db.c @@ -1,4 +1,4 @@ -/* $Id: apropos_db.c,v 1.1 2011/11/13 10:12:05 schwarze Exp $ */ +/* $Id: apropos_db.c,v 1.2 2011/11/13 10:49:57 schwarze Exp $ */ /* * Copyright (c) 2011 Kristaps Dzonsons * @@ -27,6 +27,7 @@ # include #endif +#include "mandocdb.h" #include "apropos_db.h" #include "mandoc.h" @@ -50,20 +51,21 @@ struct type { }; static const struct type types[] = { - { TYPE_NAME, "name" }, - { TYPE_FUNCTION, "func" }, - { TYPE_UTILITY, "utility" }, - { TYPE_INCLUDES, "incl" }, - { TYPE_VARIABLE, "var" }, - { TYPE_STANDARD, "stand" }, - { TYPE_AUTHOR, "auth" }, - { TYPE_CONFIG, "conf" }, - { TYPE_DESC, "desc" }, - { TYPE_XREF, "xref" }, - { TYPE_PATH, "path" }, - { TYPE_ENV, "env" }, - { TYPE_ERR, "err" }, - { INT_MAX, "all" }, + { TYPE_An, "An" }, + { TYPE_Cd, "Cd" }, + { TYPE_Er, "Er" }, + { TYPE_Ev, "Ev" }, + { TYPE_Fn, "Fn" }, + { TYPE_Fn, "Fo" }, + { TYPE_In, "In" }, + { TYPE_Nd, "Nd" }, + { TYPE_Nm, "Nm" }, + { TYPE_Pa, "Pa" }, + { TYPE_St, "St" }, + { TYPE_Va, "Va" }, + { TYPE_Va, "Vt" }, + { TYPE_Xr, "Xr" }, + { INT_MAX, "any" }, { 0, NULL } }; @@ -89,7 +91,7 @@ btree_open(void) memset(&info, 0, sizeof(BTREEINFO)); info.flags = R_DUP; - db = dbopen("mandoc.db", O_RDONLY, 0, DB_BTREE, &info); + db = dbopen(MANDOC_DB, O_RDONLY, 0, DB_BTREE, &info); if (NULL != db) return(db); @@ -274,7 +276,7 @@ index_open(void) { DB *db; - db = dbopen("mandoc.index", O_RDONLY, 0, DB_RECNO, NULL); + db = dbopen(MANDOC_IDX, O_RDONLY, 0, DB_RECNO, NULL); if (NULL != db) return(db); -- cgit v1.2.3-56-ge451