+static void dbclose(const char *, int);
+static void dbindex(struct mchars *, int,
+ const struct of *, const char *);
+static int dbopen(const char *, int);
+static void dbprune(const char *);
+static void fileadd(struct of *);
+static int filecheck(const char *);
+static void filescan(const char *, const char *);
+static struct str *hashget(const char *, size_t);
+static void *hash_alloc(size_t, void *);
+static void hash_free(void *, size_t, void *);
+static void *hash_halloc(size_t, void *);
+static void inoadd(const struct stat *, struct of *);
+static int inocheck(const struct stat *);
+static void ofadd(const char *, int, const char *,
+ const char *, const char *, const char *,
+ const char *, const struct stat *);
+static void offree(void);
+static int ofmerge(struct mchars *, struct mparse *, const char *);
+static void parse_catpage(struct of *, const char *);
+static int parse_man(struct of *,
+ const struct man_node *);
+static void parse_mdoc(struct of *, const struct mdoc_node *);
+static int parse_mdoc_body(struct of *, const struct mdoc_node *);
+static int parse_mdoc_head(struct of *, const struct mdoc_node *);
+static int parse_mdoc_Fd(struct of *, const struct mdoc_node *);
+static int parse_mdoc_Fn(struct of *, const struct mdoc_node *);
+static int parse_mdoc_In(struct of *, const struct mdoc_node *);
+static int parse_mdoc_Nd(struct of *, const struct mdoc_node *);
+static int parse_mdoc_Nm(struct of *, const struct mdoc_node *);
+static int parse_mdoc_Sh(struct of *, const struct mdoc_node *);
+static int parse_mdoc_St(struct of *, const struct mdoc_node *);
+static int parse_mdoc_Xr(struct of *, const struct mdoc_node *);
+static int path_reset(const char *, int, const char *);
+static void putkey(const struct of *,
+ const char *, uint64_t);
+static void putkeys(const struct of *,
+ const char *, int, uint64_t);
+static void putmdockey(const struct of *,
+ const struct mdoc_node *, uint64_t);
+static char *stradd(const char *);
+static char *straddbuf(const char *, size_t);
+static int treescan(const char *);
+static size_t utf8(unsigned int, char [7]);
+static void utf8key(struct mchars *, struct str *);
+static void wordaddbuf(const struct of *,
+ const char *, size_t, uint64_t);
+
+static char *progname;
+static int use_all; /* use all found files */
+static int nodb; /* no database changes */
+static int verb; /* print what we're doing */
+static int warnings; /* warn about crap */
+static enum op op; /* operational mode */
+static struct ohash inos; /* table of inodes/devices */
+static struct ohash filenames; /* table of filenames */
+static struct ohash strings; /* table of all strings */
+static struct of *ofs = NULL; /* vector of files to parse */
+static struct str *words = NULL; /* word list in current parse */
+static sqlite3 *db = NULL; /* current database */
+static sqlite3_stmt *stmts[STMT__MAX]; /* current statements */
+