summaryrefslogtreecommitdiffstats
path: root/cgi.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-07-21 22:33:01 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-07-21 22:33:01 +0000
commit8b2475f4e584d019268fec8ade22101de40acada (patch)
tree3e8f78f0c94461f3996b6bd5a5bddeeceb0f4e40 /cgi.c
parent5e6a55186f91c0f68c6029281f77e9066dcbe87e (diff)
downloadmandoc-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.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/cgi.c b/cgi.c
index 62641099..66af1151 100644
--- a/cgi.c
+++ b/cgi.c
@@ -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&amp;sec=%%S",
- scriptname);
+ snprintf(opts, sizeof(opts), "fragment,man=%s?"
+ "manpath=%s&amp;query=%%N&amp;sec=%%S&amp;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);