summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2014-07-21 22:32:56 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2014-07-21 22:32:56 +0000
commitdcf1bc42da519f21c8931de1f281828f1b4a13ae (patch)
tree1063e6cea7f62e869563e833c511c98683a90aa7 /usr.bin
parent966b1d9c667552d0777e3d763bd30da0cbdf210b (diff)
fix a minibug reported by kristaps@:
preserve manpath and arch in .Xr links
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/mandoc/cgi.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/usr.bin/mandoc/cgi.c b/usr.bin/mandoc/cgi.c
index ea00f9c97f2..dbe73e591e8 100644
--- a/usr.bin/mandoc/cgi.c
+++ b/usr.bin/mandoc/cgi.c
@@ -1,4 +1,4 @@
-/* $Id: cgi.c,v 1.18 2014/07/21 15:44:22 schwarze Exp $ */
+/* $Id: cgi.c,v 1.19 2014/07/21 22:32:55 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014 Ingo Schwarze <schwarze@usta.de>
@@ -67,7 +67,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);
@@ -781,9 +781,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) {
@@ -819,7 +820,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;
@@ -855,6 +856,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);