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

Diff for /mandoc/catman.c between version 1.6 and 1.8

version 1.6, 2011/12/16 08:04:34 version 1.8, 2011/12/18 18:51:01
Line 66  int
Line 66  int
 main(int argc, char *argv[])  main(int argc, char *argv[])
 {  {
         int              ch;          int              ch;
         char            *aux, *base;          char            *aux, *base, *conf_file;
         struct manpaths  dirs;          struct manpaths  dirs;
         char             buf[MAXPATHLEN];          char             buf[MAXPATHLEN];
         extern char     *optarg;          extern char     *optarg;
Line 81  main(int argc, char *argv[])
Line 81  main(int argc, char *argv[])
         aux = base = NULL;          aux = base = NULL;
         xstrlcpy(buf, "/var/www/cache/man.cgi", MAXPATHLEN);          xstrlcpy(buf, "/var/www/cache/man.cgi", MAXPATHLEN);
   
         while (-1 != (ch = getopt(argc, argv, "fm:M:o:v")))          while (-1 != (ch = getopt(argc, argv, "C:fm:M:o:v")))
                 switch (ch) {                  switch (ch) {
                   case ('C'):
                           conf_file = optarg;
                           break;
                 case ('f'):                  case ('f'):
                         force = 1;                          force = 1;
                         break;                          break;
Line 112  main(int argc, char *argv[])
Line 115  main(int argc, char *argv[])
         }          }
   
         memset(&dirs, 0, sizeof(struct manpaths));          memset(&dirs, 0, sizeof(struct manpaths));
         manpath_parse(&dirs, NULL, base, aux);          manpath_parse(&dirs, conf_file, base, aux);
         ch = manup(&dirs, buf);          ch = manup(&dirs, buf);
         manpath_free(&dirs);          manpath_free(&dirs);
         return(ch ? EXIT_SUCCESS : EXIT_FAILURE);          return(ch ? EXIT_SUCCESS : EXIT_FAILURE);
Line 124  usage(void)
Line 127  usage(void)
   
         fprintf(stderr, "usage: %s "          fprintf(stderr, "usage: %s "
                         "[-fv] "                          "[-fv] "
                           "[-C file] "
                         "[-o path] "                          "[-o path] "
                         "[-m manpath] "                          "[-m manpath] "
                         "[-M manpath]\n",                          "[-M manpath]\n",
Line 204  indexhtml(char *src, size_t ssz, char *dst, size_t dsz
Line 208  indexhtml(char *src, size_t ssz, char *dst, size_t dsz
         DBT              key, val;          DBT              key, val;
         int              c, rc;          int              c, rc;
         unsigned int     fl;          unsigned int     fl;
         const char      *f, *cp;          const char      *f;
         char            *d;          char            *d;
         char             fname[MAXPATHLEN];          char             fname[MAXPATHLEN];
         pid_t            pid;          pid_t            pid;
Line 223  indexhtml(char *src, size_t ssz, char *dst, size_t dsz
Line 227  indexhtml(char *src, size_t ssz, char *dst, size_t dsz
         fl = R_FIRST;          fl = R_FIRST;
         while (0 == (c = (*idx->seq)(idx, &key, &val, fl))) {          while (0 == (c = (*idx->seq)(idx, &key, &val, fl))) {
                 fl = R_NEXT;                  fl = R_NEXT;
                 cp = (const char *)val.data;                  /*
                    * If the record is zero-length, then it's unassigned.
                    * Skip past these.
                    */
                 if (0 == val.size)                  if (0 == val.size)
                         continue;                          continue;
                 if (NULL == (f = memchr(cp, '\0', val.size)))  
                         break;                  f = (const char *)val.data + 1;
                 if (++f - cp >= (int)val.size)                  if (NULL == memchr(f, '\0', val.size - 1))
                         break;  
                 if (NULL == memchr(f, '\0', val.size - (f - cp)))  
                         break;                          break;
   
                 src[(int)ssz] = dst[(int)dsz] = '\0';                  src[(int)ssz] = dst[(int)dsz] = '\0';

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

CVSweb