[BACK]Return to apropos_db.c CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / mandoc

Diff for /mandoc/Attic/apropos_db.c between version 1.10 and 1.11

version 1.10, 2011/11/20 16:29:50 version 1.11, 2011/11/23 09:55:28
Line 125  static int  exprmark(const struct expr *, 
Line 125  static int  exprmark(const struct expr *, 
 static  struct expr *exprexpr(int, char *[], int *, int *, size_t *);  static  struct expr *exprexpr(int, char *[], int *, int *, size_t *);
 static  struct expr *exprterm(char *, int);  static  struct expr *exprterm(char *, int);
 static  DB      *index_open(void);  static  DB      *index_open(void);
 static  int      index_read(const DBT *, const DBT *,  static  int      index_read(const DBT *, const DBT *, int,
                         const struct mchars *, struct rec *);                          const struct mchars *, struct rec *);
 static  void     norm_string(const char *,  static  void     norm_string(const char *,
                         const struct mchars *, char **);                          const struct mchars *, char **);
Line 133  static size_t  norm_utf8(unsigned int, char[7]);
Line 133  static size_t  norm_utf8(unsigned int, char[7]);
 static  void     recfree(struct rec *);  static  void     recfree(struct rec *);
 static  int      single_search(struct rectree *, const struct opts *,  static  int      single_search(struct rectree *, const struct opts *,
                         const struct expr *, size_t terms,                          const struct expr *, size_t terms,
                         struct mchars *);                          struct mchars *, int);
   
 /*  /*
  * Open the keyword mandoc-db database.   * Open the keyword mandoc-db database.
Line 345  index_open(void)
Line 345  index_open(void)
  * Returns 1 if an entry was unpacked, 0 if the database is insane.   * Returns 1 if an entry was unpacked, 0 if the database is insane.
  */   */
 static int  static int
 index_read(const DBT *key, const DBT *val,  index_read(const DBT *key, const DBT *val, int index,
                 const struct mchars *mc, struct rec *rec)                  const struct mchars *mc, struct rec *rec)
 {  {
         size_t           left;          size_t           left;
Line 364  index_read(const DBT *key, const DBT *val, 
Line 364  index_read(const DBT *key, const DBT *val, 
         cp = (char *)val->data;          cp = (char *)val->data;
   
         rec->res.rec = *(recno_t *)key->data;          rec->res.rec = *(recno_t *)key->data;
           rec->res.volume = index;
   
         INDEX_BREAD(rec->res.file);          INDEX_BREAD(rec->res.file);
         INDEX_BREAD(rec->res.cat);          INDEX_BREAD(rec->res.cat);
Line 402  apropos_search(int pathsz, char **paths, const struct 
Line 403  apropos_search(int pathsz, char **paths, const struct 
         for (i = 0; i < pathsz; i++) {          for (i = 0; i < pathsz; i++) {
                 if (chdir(paths[i]))                  if (chdir(paths[i]))
                         continue;                          continue;
                 if ( ! single_search(&tree, opts, expr, terms, mc))                  if ( ! single_search(&tree, opts, expr, terms, mc, i))
                         goto out;                          goto out;
         }          }
   
Line 438  out:
Line 439  out:
 static int  static int
 single_search(struct rectree *tree, const struct opts *opts,  single_search(struct rectree *tree, const struct opts *opts,
                 const struct expr *expr, size_t terms,                  const struct expr *expr, size_t terms,
                 struct mchars *mc)                  struct mchars *mc, int vol)
 {  {
         int              root, leaf, ch;          int              root, leaf, ch;
         uint64_t         mask;          uint64_t         mask;
Line 525  single_search(struct rectree *tree, const struct opts 
Line 526  single_search(struct rectree *tree, const struct opts 
                         break;                          break;
   
                 r.lhs = r.rhs = -1;                  r.lhs = r.rhs = -1;
                 if ( ! index_read(&key, &val, mc, &r))                  if ( ! index_read(&key, &val, vol, mc, &r))
                         break;                          break;
   
                 /* XXX: this should be elsewhere, I guess? */                  /* XXX: this should be elsewhere, I guess? */

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

CVSweb