diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2014-01-19 00:09:38 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2014-01-19 00:09:38 +0000 |
commit | 14fdbf7ee3b25fe3f7ed444d478c7c55c1b4a581 (patch) | |
tree | 09a4ad8c2964d5c1b32743b70aaf4b3508b76b2d /mandocdb.c | |
parent | c6d210436468b068d8eb46afb9e22aa235e80336 (diff) | |
download | mandoc-14fdbf7ee3b25fe3f7ed444d478c7c55c1b4a581.tar.gz mandoc-14fdbf7ee3b25fe3f7ed444d478c7c55c1b4a581.tar.zst mandoc-14fdbf7ee3b25fe3f7ed444d478c7c55c1b4a581.zip |
Support a second -v on mandocdb(8) to show keys while they are being added;
i need that for debugging, in particular to be used with -t.
To be able to do so, provide a global table of key names, for reuse.
Diffstat (limited to 'mandocdb.c')
-rw-r--r-- | mandocdb.c | 19 |
1 files changed, 17 insertions, 2 deletions
@@ -1,4 +1,4 @@ -/* $Id: mandocdb.c,v 1.110 2014/01/18 08:55:17 schwarze Exp $ */ +/* $Id: mandocdb.c,v 1.111 2014/01/19 00:09:38 schwarze Exp $ */ /* * Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org> @@ -48,6 +48,9 @@ #include "manpath.h" #include "mansearch.h" +extern int mansearch_keymax; +extern const char *const mansearch_keynames[]; + #define SQL_EXEC(_v) \ if (SQLITE_OK != sqlite3_exec(db, (_v), NULL, NULL, NULL)) \ fprintf(stderr, "%s\n", sqlite3_errmsg(db)) @@ -1562,12 +1565,24 @@ putkeys(const struct mpage *mpage, const char *cp, size_t sz, uint64_t v) { struct str *s; - unsigned int slot; const char *end; + uint64_t mask; + unsigned int slot; + int i; if (0 == sz) return; + if (verb > 1) { + for (i = 0, mask = 1; + i < mansearch_keymax; + i++, mask <<= 1) + if (mask & v) + break; + say(mpage->mlinks->file, "Adding key %s=%*s", + mansearch_keynames[i], sz, cp); + } + end = cp + sz; slot = ohash_qlookupi(&strings, cp, &end); s = ohash_find(&strings, slot); |