[BACK]Return to mandocdb.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / mandoc

Diff for /src/usr.bin/mandoc/mandocdb.c between version 1.6 and 1.7

version 1.6, 2011/11/14 18:52:05 version 1.7, 2011/11/17 14:52:32
Line 24 
Line 24 
 #include <stdint.h>  #include <stdint.h>
 #include <stdlib.h>  #include <stdlib.h>
 #include <string.h>  #include <string.h>
   #include <unistd.h>
 #include <db.h>  #include <db.h>
   
 #include "man.h"  #include "man.h"
 #include "mdoc.h"  #include "mdoc.h"
 #include "mandoc.h"  #include "mandoc.h"
 #include "mandocdb.h"  #include "mandocdb.h"
   #include "man_conf.h"
   
 #define MANDOC_BUFSZ      BUFSIZ  #define MANDOC_BUFSZ      BUFSIZ
 #define MANDOC_SLOP       1024  #define MANDOC_SLOP       1024
Line 242 
Line 244 
 int  int
 mandocdb(int argc, char *argv[])  mandocdb(int argc, char *argv[])
 {  {
           struct man_conf  dirs;
         struct mparse   *mp; /* parse sequence */          struct mparse   *mp; /* parse sequence */
         enum op          op; /* current operation */          enum op          op; /* current operation */
         const char      *dir;          const char      *dir;
Line 307 
Line 310 
         argc -= optind;          argc -= optind;
         argv += optind;          argv += optind;
   
           memset(&dirs, 0, sizeof(struct man_conf));
         memset(&info, 0, sizeof(BTREEINFO));          memset(&info, 0, sizeof(BTREEINFO));
         info.flags = R_DUP;          info.flags = R_DUP;
   
Line 363 
Line 367 
                 index_prune(of, db, fbuf, idx, ibuf, verb,                  index_prune(of, db, fbuf, idx, ibuf, verb,
                                 &maxrec, &recs, &recsz);                                  &maxrec, &recs, &recsz);
   
                 if (OP_UPDATE == op)                  if (OP_UPDATE == op) {
                           chdir(dir);
                         index_merge(of, mp, &dbuf, &buf, hash,                          index_merge(of, mp, &dbuf, &buf, hash,
                                         db, fbuf, idx, ibuf, use_all,                                          db, fbuf, idx, ibuf, use_all,
                                         verb, maxrec, recs, reccur);                                          verb, maxrec, recs, reccur);
                   }
   
                 goto out;                  goto out;
         }          }
   
           if (0 == argc) {
                   man_conf_parse(&dirs);
                   argc = dirs.argc;
                   argv = dirs.argv;
           }
   
         for (i = 0; i < argc; i++) {          for (i = 0; i < argc; i++) {
                 ibuf[0] = fbuf[0] = '\0';                  ibuf[0] = fbuf[0] = '\0';
   
Line 387 
Line 399 
                         exit((int)MANDOCLEVEL_BADARG);                          exit((int)MANDOCLEVEL_BADARG);
                 }                  }
   
                   if (db)
                           (*db->close)(db);
                   if (idx)
                           (*idx->close)(idx);
   
                 db = dbopen(fbuf, flags, 0644, DB_BTREE, &info);                  db = dbopen(fbuf, flags, 0644, DB_BTREE, &info);
                 idx = dbopen(ibuf, flags, 0644, DB_RECNO, NULL);                  idx = dbopen(ibuf, flags, 0644, DB_RECNO, NULL);
   
Line 415 
Line 432 
   
                 of = of->first;                  of = of->first;
   
                   chdir(argv[i]);
                 index_merge(of, mp, &dbuf, &buf, hash, db, fbuf,                  index_merge(of, mp, &dbuf, &buf, hash, db, fbuf,
                                 idx, ibuf, use_all, verb,                                  idx, ibuf, use_all, verb,
                                 maxrec, recs, reccur);                                  maxrec, recs, reccur);
Line 429 
Line 447 
                 (*hash->close)(hash);                  (*hash->close)(hash);
         if (mp)          if (mp)
                 mparse_free(mp);                  mparse_free(mp);
           if (dirs.argc)
                   man_conf_free(&dirs);
   
         ofile_free(of);          ofile_free(of);
         free(buf.cp);          free(buf.cp);

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7