summaryrefslogtreecommitdiffstats
path: root/mandocdb.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2011-11-26 22:38:11 +0000
committerIngo Schwarze <schwarze@openbsd.org>2011-11-26 22:38:11 +0000
commitedb836f226a3e9d500cba400695648b0a3ee6585 (patch)
tree9bac1273d1f20dec6c26f4b7dc1eec6b498342c7 /mandocdb.c
parent0aba7e883febd4a1eb4d3f54a32041eccd254290 (diff)
downloadmandoc-edb836f226a3e9d500cba400695648b0a3ee6585.tar.gz
Sync to OpenBSD, mostly gratuitous and whitespace differences,
but a few serious things as well: * -M overrides MANPATH * -m prepends to the path * put back database close calls that got lost in mandocdb * missing sys/types.h in manpath.c, needed for size_t ok kristaps@
Diffstat (limited to 'mandocdb.c')
-rw-r--r--mandocdb.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/mandocdb.c b/mandocdb.c
index b6b1d9a1..16027b8f 100644
--- a/mandocdb.c
+++ b/mandocdb.c
@@ -378,7 +378,7 @@ main(int argc, char *argv[])
&maxrec, &recs, &recsz);
if (OP_UPDATE == op)
- index_merge(of, mp, &dbuf, &buf, hash,
+ index_merge(of, mp, &dbuf, &buf, hash,
db, fbuf, idx, ibuf, use_all,
verb, maxrec, recs, reccur);
@@ -411,11 +411,16 @@ main(int argc, char *argv[])
sz2 = strlcat(ibuf, MANDOC_IDX, MAXPATHLEN);
if (sz1 >= MAXPATHLEN || sz2 >= MAXPATHLEN) {
- fprintf(stderr, "%s: Path too long\n",
+ fprintf(stderr, "%s: Path too long\n",
dirs.paths[i]);
exit((int)MANDOCLEVEL_BADARG);
}
+ if (db)
+ (*db->close)(db);
+ if (idx)
+ (*idx->close)(idx);
+
db = dbopen(fbuf, flags, 0644, DB_BTREE, &info);
idx = dbopen(ibuf, flags, 0644, DB_RECNO, NULL);
@@ -444,7 +449,7 @@ main(int argc, char *argv[])
of = of->first;
- index_merge(of, mp, &dbuf, &buf, hash, db, fbuf,
+ index_merge(of, mp, &dbuf, &buf, hash, db, fbuf,
idx, ibuf, use_all, verb,
maxrec, recs, reccur);
}
@@ -471,7 +476,7 @@ out:
void
index_merge(const struct of *of, struct mparse *mp,
struct buf *dbuf, struct buf *buf,
- DB *hash, DB *db, const char *dbf,
+ DB *hash, DB *db, const char *dbf,
DB *idx, const char *idxf, int use_all, int verb,
recno_t maxrec, const recno_t *recs, size_t reccur)
{