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

Diff for /mandoc/main.c between version 1.325 and 1.326

version 1.325, 2019/05/03 16:14:42 version 1.326, 2019/05/03 17:31:15
Line 21 
Line 21 
 #include <sys/types.h>  #include <sys/types.h>
 #include <sys/ioctl.h>  #include <sys/ioctl.h>
 #include <sys/param.h>  /* MACHINE */  #include <sys/param.h>  /* MACHINE */
   #include <sys/stat.h>
 #include <sys/wait.h>  #include <sys/wait.h>
   
 #include <assert.h>  #include <assert.h>
Line 713  fs_lookup(const struct manpaths *paths, size_t ipath,
Line 714  fs_lookup(const struct manpaths *paths, size_t ipath,
         const char *sec, const char *arch, const char *name,          const char *sec, const char *arch, const char *name,
         struct manpage **res, size_t *ressz)          struct manpage **res, size_t *ressz)
 {  {
           struct stat      sb;
         glob_t           globinfo;          glob_t           globinfo;
         struct manpage  *page;          struct manpage  *page;
         char            *file;          char            *file;
Line 722  fs_lookup(const struct manpaths *paths, size_t ipath,
Line 724  fs_lookup(const struct manpaths *paths, size_t ipath,
         form = FORM_SRC;          form = FORM_SRC;
         mandoc_asprintf(&file, "%s/man%s/%s.%s",          mandoc_asprintf(&file, "%s/man%s/%s.%s",
             paths->paths[ipath], sec, name, sec);              paths->paths[ipath], sec, name, sec);
         if (access(file, R_OK) != -1)          if (stat(file, &sb) != -1)
                 goto found;                  goto found;
         free(file);          free(file);
   
         mandoc_asprintf(&file, "%s/cat%s/%s.0",          mandoc_asprintf(&file, "%s/cat%s/%s.0",
             paths->paths[ipath], sec, name);              paths->paths[ipath], sec, name);
         if (access(file, R_OK) != -1) {          if (stat(file, &sb) != -1) {
                 form = FORM_CAT;                  form = FORM_CAT;
                 goto found;                  goto found;
         }          }
Line 737  fs_lookup(const struct manpaths *paths, size_t ipath,
Line 739  fs_lookup(const struct manpaths *paths, size_t ipath,
         if (arch != NULL) {          if (arch != NULL) {
                 mandoc_asprintf(&file, "%s/man%s/%s/%s.%s",                  mandoc_asprintf(&file, "%s/man%s/%s/%s.%s",
                     paths->paths[ipath], sec, arch, name, sec);                      paths->paths[ipath], sec, arch, name, sec);
                 if (access(file, R_OK) != -1)                  if (stat(file, &sb) != -1)
                         goto found;                          goto found;
                 free(file);                  free(file);
         }          }
Line 751  fs_lookup(const struct manpaths *paths, size_t ipath,
Line 753  fs_lookup(const struct manpaths *paths, size_t ipath,
         if (globres == 0)          if (globres == 0)
                 file = mandoc_strdup(*globinfo.gl_pathv);                  file = mandoc_strdup(*globinfo.gl_pathv);
         globfree(&globinfo);          globfree(&globinfo);
         if (globres == 0)          if (globres == 0) {
                 goto found;                  if (stat(file, &sb) != -1)
                           goto found;
                   free(file);
           }
         if (res != NULL || ipath + 1 != paths->sz)          if (res != NULL || ipath + 1 != paths->sz)
                 return 0;                  return 0;
   
         mandoc_asprintf(&file, "%s.%s", name, sec);          mandoc_asprintf(&file, "%s.%s", name, sec);
         globres = access(file, R_OK);          globres = stat(file, &sb);
         free(file);          free(file);
         return globres != -1;          return globres != -1;
   

Legend:
Removed from v.1.325  
changed lines
  Added in v.1.326

CVSweb