aboutsummaryrefslogtreecommitdiffstatshomepage
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
commit2cfc7310afb5b9fc57aba0d72188cc20f947c244 (patch)
tree5ee75fdd5d7026aac363e0bff57ac7e83b4780f0 /cgi.c
parentf88b6897fb2359e45d69b78cf233849c6e5552da (diff)
downloadmandoc-2cfc7310afb5b9fc57aba0d72188cc20f947c244.tar.gz
mandoc-2cfc7310afb5b9fc57aba0d72188cc20f947c244.tar.zst
mandoc-2cfc7310afb5b9fc57aba0d72188cc20f947c244.zip
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.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/cgi.c b/cgi.c
index 68bdf6e7..cfb779c2 100644
--- a/cgi.c
+++ b/cgi.c
@@ -1,4 +1,4 @@
-/* $Id: cgi.c,v 1.150 2017/03/15 13:18:53 schwarze Exp $ */
+/* $Id: cgi.c,v 1.151 2017/03/15 13:49:50 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014, 2015, 2016, 2017 Ingo Schwarze <schwarze@usta.de>
@@ -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\">");