=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/mandocdb.c,v retrieving revision 1.12 retrieving revision 1.13 diff -c -r1.12 -r1.13 *** src/usr.bin/mandoc/mandocdb.c 2011/11/27 23:11:32 1.12 --- src/usr.bin/mandoc/mandocdb.c 2011/11/27 23:27:16 1.13 *************** *** 1,4 **** ! /* $Id: mandocdb.c,v 1.12 2011/11/27 23:11:32 schwarze Exp $ */ /* * Copyright (c) 2011 Kristaps Dzonsons * Copyright (c) 2011 Ingo Schwarze --- 1,4 ---- ! /* $Id: mandocdb.c,v 1.13 2011/11/27 23:27:16 schwarze Exp $ */ /* * Copyright (c) 2011 Kristaps Dzonsons * Copyright (c) 2011 Ingo Schwarze *************** *** 88,105 **** static void hash_put(DB *, const struct buf *, uint64_t); static void hash_reset(DB **); static void index_merge(const struct of *, struct mparse *, ! struct buf *, struct buf *, ! DB *, DB *, const char *, ! DB *, const char *, int, int, recno_t, const recno_t *, size_t); static void index_prune(const struct of *, DB *, const char *, DB *, const char *, ! int, recno_t *, recno_t **, size_t *); ! static void ofile_argbuild(char *[], int, int, int, ! struct of **); static int ofile_dirbuild(const char *, const char *, ! const char *, int, int, int, ! struct of **); static void ofile_free(struct of *); static void pformatted(DB *, struct buf *, struct buf *, const struct of *); --- 88,102 ---- static void hash_put(DB *, const struct buf *, uint64_t); static void hash_reset(DB **); static void index_merge(const struct of *, struct mparse *, ! struct buf *, struct buf *, DB *, ! DB *, const char *, DB *, const char *, recno_t, const recno_t *, size_t); static void index_prune(const struct of *, DB *, const char *, DB *, const char *, ! recno_t *, recno_t **, size_t *); ! static void ofile_argbuild(int, char *[], struct of **); static int ofile_dirbuild(const char *, const char *, ! const char *, int, struct of **); static void ofile_free(struct of *); static void pformatted(DB *, struct buf *, struct buf *, const struct of *); *************** *** 249,254 **** --- 246,253 ---- }; static const char *progname; + static int use_all; /* Use all directories and files. */ + static int verb; /* Output verbosity level. */ int mandocdb(int argc, char *argv[]) *************** *** 259,267 **** const char *dir; char ibuf[MAXPATHLEN], /* index fname */ fbuf[MAXPATHLEN]; /* btree fname */ ! int verb, /* output verbosity */ ! use_all, /* use all directories and files */ ! ch, i, flags; DB *idx, /* index database */ *db, /* keyword database */ *hash; /* temporary keyword hashtable */ --- 258,264 ---- const char *dir; char ibuf[MAXPATHLEN], /* index fname */ fbuf[MAXPATHLEN]; /* btree fname */ ! int ch, i, flags; DB *idx, /* index database */ *db, /* keyword database */ *hash; /* temporary keyword hashtable */ *************** *** 368,386 **** printf("%s: Opened\n", ibuf); } ! ofile_argbuild(argv, argc, use_all, verb, &of); if (NULL == of) goto out; of = of->first; ! index_prune(of, db, fbuf, idx, ibuf, verb, &maxrec, &recs, &recsz); if (OP_UPDATE == op) index_merge(of, mp, &dbuf, &buf, hash, ! db, fbuf, idx, ibuf, use_all, ! verb, maxrec, recs, reccur); goto out; } --- 365,383 ---- printf("%s: Opened\n", ibuf); } ! ofile_argbuild(argc, argv, &of); if (NULL == of) goto out; of = of->first; ! index_prune(of, db, fbuf, idx, ibuf, &maxrec, &recs, &recsz); if (OP_UPDATE == op) index_merge(of, mp, &dbuf, &buf, hash, ! db, fbuf, idx, ibuf, ! maxrec, recs, reccur); goto out; } *************** *** 441,447 **** of = NULL; if ( ! ofile_dirbuild(dirs.paths[i], NULL, NULL, ! 0, use_all, verb, &of)) exit((int)MANDOCLEVEL_SYSERR); if (NULL == of) --- 438,444 ---- of = NULL; if ( ! ofile_dirbuild(dirs.paths[i], NULL, NULL, ! 0, &of)) exit((int)MANDOCLEVEL_SYSERR); if (NULL == of) *************** *** 450,457 **** of = of->first; index_merge(of, mp, &dbuf, &buf, hash, db, fbuf, ! idx, ibuf, use_all, verb, ! maxrec, recs, reccur); } out: --- 447,453 ---- of = of->first; index_merge(of, mp, &dbuf, &buf, hash, db, fbuf, ! idx, ibuf, maxrec, recs, reccur); } out: *************** *** 475,483 **** void index_merge(const struct of *of, struct mparse *mp, ! struct buf *dbuf, struct buf *buf, ! 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) { recno_t rec; --- 471,478 ---- void index_merge(const struct of *of, struct mparse *mp, ! struct buf *dbuf, struct buf *buf, DB *hash, ! DB *db, const char *dbf, DB *idx, const char *idxf, recno_t maxrec, const recno_t *recs, size_t reccur) { recno_t rec; *************** *** 653,659 **** */ static void index_prune(const struct of *ofile, DB *db, const char *dbf, ! DB *idx, const char *idxf, int verb, recno_t *maxrec, recno_t **recs, size_t *recsz) { const struct of *of; --- 648,654 ---- */ static void index_prune(const struct of *ofile, DB *db, const char *dbf, ! DB *idx, const char *idxf, recno_t *maxrec, recno_t **recs, size_t *recsz) { const struct of *of; *************** *** 1327,1334 **** } static void ! ofile_argbuild(char *argv[], int argc, int use_all, int verb, ! struct of **of) { char buf[MAXPATHLEN]; char *sec, *arch, *title, *p; --- 1322,1328 ---- } static void ! ofile_argbuild(int argc, char *argv[], struct of **of) { char buf[MAXPATHLEN]; char *sec, *arch, *title, *p; *************** *** 1420,1426 **** */ static int ofile_dirbuild(const char *dir, const char* psec, const char *parch, ! int p_src_form, int use_all, int verb, struct of **of) { char buf[MAXPATHLEN]; struct stat sb; --- 1414,1420 ---- */ static int ofile_dirbuild(const char *dir, const char* psec, const char *parch, ! int p_src_form, struct of **of) { char buf[MAXPATHLEN]; struct stat sb; *************** *** 1486,1492 **** printf("%s: Scanning\n", buf); if ( ! ofile_dirbuild(buf, sec, arch, ! src_form, use_all, verb, of)) return(0); } if (DT_REG != dp->d_type || --- 1480,1486 ---- printf("%s: Scanning\n", buf); if ( ! ofile_dirbuild(buf, sec, arch, ! src_form, of)) return(0); } if (DT_REG != dp->d_type ||