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

Diff for /mandoc/mansearch.c between version 1.77 and 1.80

version 1.77, 2017/08/22 17:50:11 version 1.80, 2018/12/13 11:55:46
Line 1 
Line 1 
 /*      $Id$ */  /*      $Id$ */
 /*  /*
  * Copyright (c) 2012 Kristaps Dzonsons <kristaps@bsd.lv>   * Copyright (c) 2012 Kristaps Dzonsons <kristaps@bsd.lv>
  * Copyright (c) 2013-2017 Ingo Schwarze <schwarze@openbsd.org>   * Copyright (c) 2013-2018 Ingo Schwarze <schwarze@openbsd.org>
  *   *
  * Permission to use, copy, modify, and distribute this software for any   * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above   * purpose with or without fee is hereby granted, provided that the above
Line 36 
Line 36 
 #include <string.h>  #include <string.h>
 #include <unistd.h>  #include <unistd.h>
   
 #include "mandoc.h"  
 #include "mandoc_aux.h"  #include "mandoc_aux.h"
 #include "mandoc_ohash.h"  #include "mandoc_ohash.h"
 #include "manconf.h"  #include "manconf.h"
Line 201  mansearch(const struct mansearch *search,
Line 200  mansearch(const struct mansearch *search,
                         mpage->names = buildnames(page);                          mpage->names = buildnames(page);
                         mpage->output = buildoutput(outkey, page);                          mpage->output = buildoutput(outkey, page);
                         mpage->ipath = i;                          mpage->ipath = i;
                         mpage->bits = rp->bits;  
                         mpage->sec = *page->sect - '0';                          mpage->sec = *page->sect - '0';
                         if (mpage->sec < 0 || mpage->sec > 9)                          if (mpage->sec < 0 || mpage->sec > 9)
                                 mpage->sec = 10;                                  mpage->sec = 10;
Line 296  manmerge_term(struct expr *e, struct ohash *htab)
Line 294  manmerge_term(struct expr *e, struct ohash *htab)
                                 break;                                  break;
                         slot = ohash_lookup_memory(htab,                          slot = ohash_lookup_memory(htab,
                             (char *)&res, sizeof(res.page), res.page);                              (char *)&res, sizeof(res.page), res.page);
                         if ((rp = ohash_find(htab, slot)) != NULL) {                          if ((rp = ohash_find(htab, slot)) != NULL)
                                 rp->bits |= res.bits;  
                                 continue;                                  continue;
                         }  
                         rp = mandoc_malloc(sizeof(*rp));                          rp = mandoc_malloc(sizeof(*rp));
                         *rp = res;                          *rp = res;
                         ohash_insert(htab, slot, rp);                          ohash_insert(htab, slot, rp);
Line 412  manpage_compare(const void *vp1, const void *vp2)
Line 408  manpage_compare(const void *vp1, const void *vp2)
   
         mp1 = vp1;          mp1 = vp1;
         mp2 = vp2;          mp2 = vp2;
         if ((diff = mp2->bits - mp1->bits) ||          if ((diff = mp1->sec - mp2->sec))
             (diff = mp1->sec - mp2->sec))  
                 return diff;                  return diff;
   
         /* Fall back to alphabetic ordering of names. */          /* Fall back to alphabetic ordering of names. */
Line 774  exprterm(const struct mansearch *search, int argc, cha
Line 769  exprterm(const struct mansearch *search, int argc, cha
                 cs = 0;                  cs = 0;
         } else if ((val = strpbrk(argv[*argi], "=~")) == NULL) {          } else if ((val = strpbrk(argv[*argi], "=~")) == NULL) {
                 e->bits = TYPE_Nm | TYPE_Nd;                  e->bits = TYPE_Nm | TYPE_Nd;
                 e->match.type = DBM_SUB;                  e->match.type = DBM_REGEX;
                 e->match.str = argv[*argi];                  val = argv[*argi];
                   cs = 0;
         } else {          } else {
                 if (val == argv[*argi])                  if (val == argv[*argi])
                         e->bits = TYPE_Nm | TYPE_Nd;                          e->bits = TYPE_Nm | TYPE_Nd;

Legend:
Removed from v.1.77  
changed lines
  Added in v.1.80

CVSweb