-/* $Id: apropos.c,v 1.19 2013/12/31 03:41:09 schwarze Exp $ */
+/* $Id: apropos.c,v 1.20 2014/01/06 03:02:39 schwarze Exp $ */
/*
* Copyright (c) 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013 Ingo Schwarze <schwarze@openbsd.org>
char *defpaths, *auxpaths;
char *conf_file;
char *progname;
- char *outkey;
+ const char *outkey;
extern char *optarg;
extern int optind;
auxpaths = defpaths = NULL;
conf_file = NULL;
- outkey = NULL;
+ outkey = "Nd";
while (-1 != (ch = getopt(argc, argv, "C:M:m:O:S:s:")))
switch (ch) {
for (i = 0; i < sz; i++) {
printf("%s - %s\n", res[i].names,
- NULL == outkey ? res[i].desc :
NULL == res[i].output ? "" : res[i].output);
free(res[i].file);
free(res[i].names);
- free(res[i].desc);
free(res[i].output);
}
-/* $Id: mandocdb.c,v 1.59 2014/01/05 20:26:27 schwarze Exp $ */
+/* $Id: mandocdb.c,v 1.60 2014/01/06 03:02:40 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
{
struct mlink *mlink;
struct str *key;
- const char *desc;
int64_t recno;
size_t i;
unsigned int slot;
if (nodb)
return;
- desc = "";
- if (NULL != mpage->desc && '\0' != *mpage->desc) {
- key = ohash_find(&strings,
- ohash_qlookup(&strings, mpage->desc));
- assert(NULL != key);
- if (NULL == key->rendered)
- render_key(mc, key);
- desc = key->rendered;
- }
-
SQL_EXEC("BEGIN TRANSACTION");
i = 1;
- SQL_BIND_TEXT(stmts[STMT_INSERT_PAGE], i, desc);
SQL_BIND_INT(stmts[STMT_INSERT_PAGE], i, FORM_SRC == mpage->form);
SQL_STEP(stmts[STMT_INSERT_PAGE]);
recno = sqlite3_last_insert_rowid(db);
}
sql = "CREATE TABLE \"mpages\" (\n"
- " \"desc\" TEXT NOT NULL,\n"
" \"form\" INTEGER NOT NULL,\n"
" \"id\" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL\n"
");\n"
sql = "DELETE FROM mpages where file=?";
sqlite3_prepare_v2(db, sql, -1, &stmts[STMT_DELETE_PAGE], NULL);
sql = "INSERT INTO mpages "
- "(desc,form) VALUES (?,?)";
+ "(form) VALUES (?)";
sqlite3_prepare_v2(db, sql, -1, &stmts[STMT_INSERT_PAGE], NULL);
sql = "INSERT INTO mlinks "
"(file,sec,arch,name,pageid) VALUES (?,?,?,?,?)";
-/* $Id: mansearch.c,v 1.8 2014/01/05 04:13:46 schwarze Exp $ */
+/* $Id: mansearch.c,v 1.9 2014/01/06 03:02:40 schwarze Exp $ */
/*
* Copyright (c) 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
struct match {
uint64_t id; /* identifier in database */
- char *desc; /* description of manpage */
int form; /* 0 == catpage */
};
* distribution of buckets in the table.
*/
while (SQLITE_ROW == (c = sqlite3_step(s))) {
- id = sqlite3_column_int64(s, 2);
+ id = sqlite3_column_int64(s, 1);
idx = ohash_lookup_memory
(&htab, (char *)&id,
sizeof(uint64_t), (uint32_t)id);
mp = mandoc_calloc(1, sizeof(struct match));
mp->id = id;
- mp->desc = mandoc_strdup
- ((char *)sqlite3_column_text(s, 0));
- mp->form = sqlite3_column_int(s, 1);
+ mp->form = sqlite3_column_int(s, 0);
ohash_insert(&htab, idx, mp);
}
(*res, maxres * sizeof(struct manpage));
}
mpage = *res + cur;
- mpage->desc = mp->desc;
mpage->form = mp->form;
buildnames(mpage, db, s, mp->id, paths->paths[i]);
mpage->output = outbit ?
-/* $Id: mansearch.h,v 1.3 2014/01/05 00:29:49 schwarze Exp $ */
+/* $Id: mansearch.h,v 1.4 2014/01/06 03:02:40 schwarze Exp $ */
/*
* Copyright (c) 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013 Ingo Schwarze <schwarze@openbsd.org>
struct manpage {
char *file; /* to be prefixed by manpath */
char *names; /* a list of names with sections */
- char *desc; /* description of manpage */
char *output; /* user-defined additional output */
int form; /* 0 == catpage */
};