version 1.101, 2014/11/11 19:04:55 |
version 1.103, 2015/01/15 04:26:39 |
Line 163 http_printquery(const struct req *req, const char *sep |
|
Line 163 http_printquery(const struct req *req, const char *sep |
|
printf("%sarch=", sep); |
printf("%sarch=", sep); |
http_print(req->q.arch); |
http_print(req->q.arch); |
} |
} |
if (NULL != req->q.manpath && |
if (strcmp(req->q.manpath, req->p[0])) { |
strcmp(req->q.manpath, req->p[0])) { |
|
printf("%smanpath=", sep); |
printf("%smanpath=", sep); |
http_print(req->q.manpath); |
http_print(req->q.manpath); |
} |
} |
|
|
if (*qs != '\0') |
if (*qs != '\0') |
qs++; |
qs++; |
} |
} |
|
|
/* Fall back to the default manpath. */ |
|
|
|
if (req->q.manpath == NULL) |
|
req->q.manpath = mandoc_strdup(req->p[0]); |
|
} |
} |
|
|
static void |
static void |
Line 469 resp_searchform(const struct req *req) |
|
Line 463 resp_searchform(const struct req *req) |
|
puts("<SELECT NAME=\"manpath\">"); |
puts("<SELECT NAME=\"manpath\">"); |
for (i = 0; i < (int)req->psz; i++) { |
for (i = 0; i < (int)req->psz; i++) { |
printf("<OPTION "); |
printf("<OPTION "); |
if (NULL == req->q.manpath ? 0 == i : |
if (strcmp(req->q.manpath, req->p[i]) == 0) |
0 == strcmp(req->q.manpath, req->p[i])) |
|
printf("SELECTED=\"selected\" "); |
printf("SELECTED=\"selected\" "); |
printf("VALUE=\""); |
printf("VALUE=\""); |
html_print(req->p[i]); |
html_print(req->p[i]); |
Line 829 format(const struct req *req, const char *file) |
|
Line 822 format(const struct req *req, const char *file) |
|
struct man *man; |
struct man *man; |
void *vp; |
void *vp; |
char *opts; |
char *opts; |
enum mandoclevel rc; |
|
int fd; |
int fd; |
int usepath; |
int usepath; |
|
|
Line 839 format(const struct req *req, const char *file) |
|
Line 831 format(const struct req *req, const char *file) |
|
} |
} |
|
|
mchars = mchars_alloc(); |
mchars = mchars_alloc(); |
mp = mparse_alloc(MPARSE_SO, MANDOCLEVEL_FATAL, NULL, |
mp = mparse_alloc(MPARSE_SO, MANDOCLEVEL_BADARG, NULL, |
mchars, req->q.manpath); |
mchars, req->q.manpath); |
rc = mparse_readfd(mp, fd, file); |
mparse_readfd(mp, fd, file); |
close(fd); |
close(fd); |
|
|
if (rc >= MANDOCLEVEL_FATAL) { |
|
fprintf(stderr, "fatal mandoc error: %s/%s\n", |
|
req->q.manpath, file); |
|
pg_error_internal(); |
|
return; |
|
} |
|
|
|
usepath = strcmp(req->q.manpath, req->p[0]); |
usepath = strcmp(req->q.manpath, req->p[0]); |
mandoc_asprintf(&opts, |
mandoc_asprintf(&opts, |
"fragment,man=%s?query=%%N&sec=%%S%s%s%s%s", |
"fragment,man=%s?query=%%N&sec=%%S%s%s%s%s", |
|
|
if (NULL != (querystring = getenv("QUERY_STRING"))) |
if (NULL != (querystring = getenv("QUERY_STRING"))) |
http_parse(&req, querystring); |
http_parse(&req, querystring); |
|
|
if ( ! (NULL == req.q.manpath || |
if (req.q.manpath == NULL) |
validate_manpath(&req, req.q.manpath))) { |
req.q.manpath = mandoc_strdup(req.p[0]); |
|
else if ( ! validate_manpath(&req, req.q.manpath)) { |
pg_error_badrequest( |
pg_error_badrequest( |
"You specified an invalid manpath."); |
"You specified an invalid manpath."); |
return(EXIT_FAILURE); |
return(EXIT_FAILURE); |