version 1.325, 2019/05/03 16:14:42 |
version 1.327, 2019/05/03 18:39:34 |
|
|
#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 299 main(int argc, char *argv[]) |
|
Line 300 main(int argc, char *argv[]) |
|
search.outkey = oarg; |
search.outkey = oarg; |
else { |
else { |
while (oarg != NULL) { |
while (oarg != NULL) { |
thisarg = oarg; |
|
if (manconf_output(&conf.output, |
if (manconf_output(&conf.output, |
strsep(&oarg, ","), 0) == 0) |
strsep(&oarg, ","), 0) == -1) |
continue; |
return (int)MANDOCLEVEL_BADARG; |
warnx("-O %s: Bad argument", thisarg); |
|
return (int)MANDOCLEVEL_BADARG; |
|
} |
} |
} |
} |
} |
} |
Line 713 fs_lookup(const struct manpaths *paths, size_t ipath, |
|
Line 711 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 721 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 736 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 750 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; |
|
|