summaryrefslogtreecommitdiffstats
path: root/usr.bin/mandoc/cgi.c
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2017-03-15 13:49:26 +0000
committerschwarze <schwarze@openbsd.org>2017-03-15 13:49:26 +0000
commit7b3dbe16a0d823fee88bae22ceb868e686744122 (patch)
treef1fc23f8a4081343cd3034e778eda8c2eeae1269 /usr.bin/mandoc/cgi.c
parentMention the manual page name and section in the HTML page <title>. (diff)
downloadwireguard-openbsd-7b3dbe16a0d823fee88bae22ceb868e686744122.tar.xz
wireguard-openbsd-7b3dbe16a0d823fee88bae22ceb868e686744122.zip
In URIs in apropos(1) result tables,
only write the manpath if it does not match the default.
Diffstat (limited to 'usr.bin/mandoc/cgi.c')
-rw-r--r--usr.bin/mandoc/cgi.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/usr.bin/mandoc/cgi.c b/usr.bin/mandoc/cgi.c
index 6cff4629e96..6b247bcf090 100644
--- a/usr.bin/mandoc/cgi.c
+++ b/usr.bin/mandoc/cgi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cgi.c,v 1.88 2017/03/15 13:18:48 schwarze Exp $ */
+/* $OpenBSD: cgi.c,v 1.89 2017/03/15 13:49:26 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014, 2015, 2016, 2017 Ingo Schwarze <schwarze@usta.de>
@@ -649,9 +649,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\">");