From 8f00108b9e7335a68e0dfa8b30abc8679c8c6a0a Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Sat, 26 Nov 2011 22:38:11 +0000 Subject: 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@ --- mandocdb.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'mandocdb.c') diff --git a/mandocdb.c b/mandocdb.c index 69976a38..cf583647 100644 --- a/mandocdb.c +++ b/mandocdb.c @@ -1,4 +1,4 @@ -/* $Id: mandocdb.c,v 1.12 2011/11/26 11:23:56 schwarze Exp $ */ +/* $Id: mandocdb.c,v 1.13 2011/11/26 22:38:11 schwarze Exp $ */ /* * Copyright (c) 2011 Kristaps Dzonsons * Copyright (c) 2011 Ingo Schwarze @@ -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) { -- cgit v1.2.3