summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2017-03-15 13:49:27 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2017-03-15 13:49:27 +0000
commit7a00f75f1939163102bf9679143f8225da5bedb0 (patch)
treedb9c4aa50e60f6fc176f6bfc3369f872b2235927 /usr.bin/mandoc
parente9fc033046b97590acdc59056f431bc8e2693290 (diff)
In URIs in apropos(1) result tables,
only write the manpath if it does not match the default.
Diffstat (limited to 'usr.bin/mandoc')
-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\">");