=================================================================== RCS file: /cvs/mandoc/cgi.c,v retrieving revision 1.78 retrieving revision 1.79 diff -u -p -r1.78 -r1.79 --- mandoc/cgi.c 2014/07/21 15:45:17 1.78 +++ mandoc/cgi.c 2014/07/21 22:33:01 1.79 @@ -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 * Copyright (c) 2014 Ingo Schwarze @@ -71,7 +71,7 @@ static void pg_noresult(const struct req *, const ch 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; @@ -858,6 +859,9 @@ pg_show(const struct req *req, const char *path) "You specified an invalid manual file."); return; } + + if (strcmp(path, "mandoc")) + req->q.manpath = path; resp_begin_html(200, NULL); resp_searchform(req);