version 1.44, 2012/05/27 17:48:57 |
version 1.45, 2013/06/05 02:00:26 |
|
|
#include "config.h" |
#include "config.h" |
#endif |
#endif |
|
|
#include <sys/param.h> |
|
#include <sys/wait.h> |
#include <sys/wait.h> |
|
|
#include <assert.h> |
#include <assert.h> |
Line 726 format(const struct req *req, const char *file) |
|
Line 725 format(const struct req *req, const char *file) |
|
struct man *man; |
struct man *man; |
void *vp; |
void *vp; |
enum mandoclevel rc; |
enum mandoclevel rc; |
char opts[MAXPATHLEN + 128]; |
char opts[PATH_MAX + 128]; |
|
|
if (-1 == (fd = open(file, O_RDONLY, 0))) { |
if (-1 == (fd = open(file, O_RDONLY, 0))) { |
resp_baddb(); |
resp_baddb(); |
Line 777 pg_show(const struct req *req, char *path) |
|
Line 776 pg_show(const struct req *req, char *path) |
|
struct manpaths ps; |
struct manpaths ps; |
size_t sz; |
size_t sz; |
char *sub; |
char *sub; |
char file[MAXPATHLEN]; |
char file[PATH_MAX]; |
const char *cp; |
const char *cp; |
int rc, catm; |
int rc, catm; |
unsigned int vol, rec, mr; |
unsigned int vol, rec, mr; |
Line 831 pg_show(const struct req *req, char *path) |
|
Line 830 pg_show(const struct req *req, char *path) |
|
goto out; |
goto out; |
} |
} |
|
|
sz = strlcpy(file, ps.paths[vol], MAXPATHLEN); |
sz = strlcpy(file, ps.paths[vol], PATH_MAX); |
assert(sz < MAXPATHLEN); |
assert(sz < PATH_MAX); |
strlcat(file, "/", MAXPATHLEN); |
strlcat(file, "/", PATH_MAX); |
strlcat(file, MANDOC_IDX, MAXPATHLEN); |
strlcat(file, MANDOC_IDX, PATH_MAX); |
|
|
/* Open the index recno(3) database. */ |
/* Open the index recno(3) database. */ |
|
|
Line 863 pg_show(const struct req *req, char *path) |
|
Line 862 pg_show(const struct req *req, char *path) |
|
resp_baddb(); |
resp_baddb(); |
else { |
else { |
file[(int)sz] = '\0'; |
file[(int)sz] = '\0'; |
strlcat(file, "/", MAXPATHLEN); |
strlcat(file, "/", PATH_MAX); |
strlcat(file, cp, MAXPATHLEN); |
strlcat(file, cp, PATH_MAX); |
if (catm) |
if (catm) |
catman(req, file); |
catman(req, file); |
else |
else |
|
|
main(void) |
main(void) |
{ |
{ |
int i; |
int i; |
char buf[MAXPATHLEN]; |
char buf[PATH_MAX]; |
DIR *cwd; |
DIR *cwd; |
struct req req; |
struct req req; |
char *p, *path, *subpath; |
char *p, *path, *subpath; |
|
|
|
|
memset(&req, 0, sizeof(struct req)); |
memset(&req, 0, sizeof(struct req)); |
|
|
strlcpy(buf, ".", MAXPATHLEN); |
strlcpy(buf, ".", PATH_MAX); |
pathgen(cwd, buf, &req); |
pathgen(cwd, buf, &req); |
closedir(cwd); |
closedir(cwd); |
|
|
Line 1120 pathgen(DIR *dir, char *path, struct req *req) |
|
Line 1119 pathgen(DIR *dir, char *path, struct req *req) |
|
int rc; |
int rc; |
size_t sz, ssz; |
size_t sz, ssz; |
|
|
sz = strlcat(path, "/", MAXPATHLEN); |
sz = strlcat(path, "/", PATH_MAX); |
if (sz >= MAXPATHLEN) { |
if (sz >= PATH_MAX) { |
fprintf(stderr, "%s: Path too long", path); |
fprintf(stderr, "%s: Path too long", path); |
return; |
return; |
} |
} |
Line 1138 pathgen(DIR *dir, char *path, struct req *req) |
|
Line 1137 pathgen(DIR *dir, char *path, struct req *req) |
|
continue; |
continue; |
|
|
path[(int)sz] = '\0'; |
path[(int)sz] = '\0'; |
ssz = strlcat(path, d->d_name, MAXPATHLEN); |
ssz = strlcat(path, d->d_name, PATH_MAX); |
|
|
if (ssz >= MAXPATHLEN) { |
if (ssz >= PATH_MAX) { |
fprintf(stderr, "%s: Path too long", path); |
fprintf(stderr, "%s: Path too long", path); |
return; |
return; |
} else if (NULL == (cd = opendir(path))) { |
} else if (NULL == (cd = opendir(path))) { |
Line 1187 pathgen(DIR *dir, char *path, struct req *req) |
|
Line 1186 pathgen(DIR *dir, char *path, struct req *req) |
|
continue; |
continue; |
|
|
path[(int)sz] = '\0'; |
path[(int)sz] = '\0'; |
ssz = strlcat(path, d->d_name, MAXPATHLEN); |
ssz = strlcat(path, d->d_name, PATH_MAX); |
|
|
if (ssz >= MAXPATHLEN) { |
if (ssz >= PATH_MAX) { |
fprintf(stderr, "%s: Path too long", path); |
fprintf(stderr, "%s: Path too long", path); |
return; |
return; |
} else if (NULL == (cd = opendir(path))) { |
} else if (NULL == (cd = opendir(path))) { |