summaryrefslogtreecommitdiffstats
path: root/cgi.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2017-03-15 13:49:50 +0000
committerIngo Schwarze <schwarze@openbsd.org>2017-03-15 13:49:50 +0000
commit0f790e66e278261421be6bb2b1285564f929469a (patch)
treeeeb5b8ed2bf70c3c871519c6db54d669ba134aef /cgi.c
parent45aa7e5c566905aca26d452ba4a9467300d052ff (diff)
downloadmandoc-0f790e66e278261421be6bb2b1285564f929469a.tar.gz
In URIs in apropos(1) result tables,
only write the manpath if it does not match the default.
Diffstat (limited to 'cgi.c')
-rw-r--r--cgi.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/cgi.c b/cgi.c
index e9d1a080..e336a51d 100644
--- a/cgi.c
+++ b/cgi.c
@@ -653,9 +653,12 @@ pg_searchres(const struct req *req, struct manpage *r, size_t sz)
for (i = 0; i < sz; i++) {
printf(" <tr>\n"
" <td>"
- "<a class=\"Xr\" href=\"/%s%s%s/%s\">",
- scriptname, *scriptname == '\0' ? "" : "/",
- req->q.manpath, r[i].file);
+ "<a class=\"Xr\" href=\"/");
+ if (*scriptname != '\0')
+ printf("%s/", scriptname);
+ if (strcmp(req->q.manpath, req->p[0]))
+ printf("%s/", req->q.manpath);
+ printf("%s\">", r[i].file);
html_print(r[i].names);
printf("</a></td>\n"
" <td><span class=\"Nd\">");