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

Diff for /mandoc/mansearch.c between version 1.76 and 1.84

version 1.76, 2017/08/02 13:29:04 version 1.84, 2023/04/28 19:11:03
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 188  mansearch(const struct mansearch *search,
Line 187  mansearch(const struct mansearch *search,
                         mpage = *res + cur;                          mpage = *res + cur;
                         mandoc_asprintf(&mpage->file, "%s/%s",                          mandoc_asprintf(&mpage->file, "%s/%s",
                             paths->paths[i], page->file + 1);                              paths->paths[i], page->file + 1);
                           if (access(chdir_status ? page->file + 1 :
                               mpage->file, R_OK) == -1) {
                                   warn("%s", mpage->file);
                                   warnx("outdated mandoc.db contains "
                                       "bogus %s entry, run makewhatis %s",
                                       page->file + 1, paths->paths[i]);
                                   free(mpage->file);
                                   free(rp);
                                   continue;
                           }
                         mpage->names = buildnames(page);                          mpage->names = buildnames(page);
                         mpage->output = buildoutput(outkey, page);                          mpage->output = buildoutput(outkey, page);
                           mpage->bits = search->firstmatch ? rp->bits : 0;
                         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 211  mansearch(const struct mansearch *search,
Line 220  mansearch(const struct mansearch *search,
                 if (cur && search->firstmatch)                  if (cur && search->firstmatch)
                         break;                          break;
         }          }
         if (res != NULL)          if (res != NULL && cur > 1)
                 qsort(*res, cur, sizeof(struct manpage), manpage_compare);                  qsort(*res, cur, sizeof(struct manpage), manpage_compare);
         if (chdir_status && getcwd_status && chdir(buf) == -1)          if (chdir_status && getcwd_status && chdir(buf) == -1)
                 warn("%s", buf);                  warn("%s", buf);
Line 482  lstlen(const char *cp, size_t sep)
Line 491  lstlen(const char *cp, size_t sep)
   
 /*  /*
  * Print the NUL-terminated list of NUL-terminated strings   * Print the NUL-terminated list of NUL-terminated strings
  * into the buffer, seperating strings with sep.   * into the buffer, separating strings with sep.
  */   */
 static void  static void
 lstcat(char *buf, size_t *i, const char *cp, const char *sep)  lstcat(char *buf, size_t *i, const char *cp, const char *sep)
Line 764  exprterm(const struct mansearch *search, int argc, cha
Line 773  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.76  
changed lines
  Added in v.1.84

CVSweb