aboutsummaryrefslogtreecommitdiffstatshomepage
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
commitaba9031e6363caf45106966958a9572dde8fc7f3 (patch)
tree2dd520edc7f98c757175c823f9878bdb49c5fdca /cgi.c
parent8abda0bf9851e11dece9e760efd941edd920eee5 (diff)
downloadmandoc-aba9031e6363caf45106966958a9572dde8fc7f3.tar.gz
mandoc-aba9031e6363caf45106966958a9572dde8fc7f3.tar.zst
mandoc-aba9031e6363caf45106966958a9572dde8fc7f3.zip
fix a minibug reported by kristaps@:
preserve manpath and arch in .Xr links
Diffstat (limited to 'cgi.c')
-rw-r--r--cgi.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/cgi.c b/cgi.c
index e79a6498..9445845b 100644
--- a/cgi.c
+++ b/cgi.c
@@ -1,4 +1,4 @@
-/* $Id: cgi.c,v 1.78 2014/07/21 15:45:17 schwarze Exp $ */
+/* $Id: cgi.c,v 1.79 2014/07/21 22:33:01 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014 Ingo Schwarze <schwarze@usta.de>
@@ -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);