diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2014-07-21 22:33:01 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2014-07-21 22:33:01 +0000 |
commit | 8b2475f4e584d019268fec8ade22101de40acada (patch) | |
tree | 3e8f78f0c94461f3996b6bd5a5bddeeceb0f4e40 /cgi.c | |
parent | 5e6a55186f91c0f68c6029281f77e9066dcbe87e (diff) | |
download | mandoc-8b2475f4e584d019268fec8ade22101de40acada.tar.gz |
fix a minibug reported by kristaps@:
preserve manpath and arch in .Xr links
Diffstat (limited to 'cgi.c')
-rw-r--r-- | cgi.c | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -71,7 +71,7 @@ static void pg_noresult(const struct req *, const char *); static void pg_search(const struct req *); static void pg_searchres(const struct req *, struct manpage *, size_t); -static void pg_show(const struct req *, const char *); +static void pg_show(struct req *, const char *); static void resp_begin_html(int, const char *); static void resp_begin_http(int, const char *); static void resp_end_html(void); @@ -785,9 +785,10 @@ format(const struct req *req, const char *file) return; } - snprintf(opts, sizeof(opts), - "fragment,man=%s?query=%%N&sec=%%S", - scriptname); + snprintf(opts, sizeof(opts), "fragment,man=%s?" + "manpath=%s&query=%%N&sec=%%S&arch=%s", + scriptname, req->q.manpath, + req->q.arch ? req->q.arch : ""); mparse_result(mp, &mdoc, &man, NULL); if (NULL == man && NULL == mdoc) { @@ -823,7 +824,7 @@ resp_show(const struct req *req, const char *file) } static void -pg_show(const struct req *req, const char *path) +pg_show(struct req *req, const char *path) { char *sub; @@ -859,6 +860,9 @@ pg_show(const struct req *req, const char *path) return; } + if (strcmp(path, "mandoc")) + req->q.manpath = path; + resp_begin_html(200, NULL); resp_searchform(req); resp_show(req, sub); |