aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2016-07-10 10:05:33 +0000
committerIngo Schwarze <schwarze@openbsd.org>2016-07-10 10:05:33 +0000
commit98cf244417f3775dc30cd3f62214c24580ebb1d9 (patch)
treef9dad40ad0b23a9537cffc71121f59facc579046
parent36f8b0346763c9e48c0f659a3bc28649645ef5c4 (diff)
downloadmandoc-98cf244417f3775dc30cd3f62214c24580ebb1d9.tar.gz
mandoc-98cf244417f3775dc30cd3f62214c24580ebb1d9.tar.zst
mandoc-98cf244417f3775dc30cd3f62214c24580ebb1d9.zip
Simplify the code and the server setup by deleting the pseudo-manpath
"mandoc" that was used for man.cgi(8) documentation and by assuming that the apropos(1) and man.cgi(8) manuals are simply installed in the default manpath. Even though man.cgi(8) is not installed by default when installing OpenBSD, it is easy to copy it into the default manpath used for man.cgi(8). Idea found when considering a question asked by wrant dot com.
-rw-r--r--Makefile6
-rw-r--r--cgi.c16
-rw-r--r--man.cgi.825
3 files changed, 17 insertions, 30 deletions
diff --git a/Makefile b/Makefile
index 72c011a6..f9489e63 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.485 2016/07/08 20:46:10 schwarze Exp $
+# $Id: Makefile,v 1.486 2016/07/10 10:05:33 schwarze Exp $
#
# Copyright (c) 2010, 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
# Copyright (c) 2011, 2013-2016 Ingo Schwarze <schwarze@openbsd.org>
@@ -397,12 +397,8 @@ db-install: base-build
cgi-install: cgi-build
mkdir -p $(DESTDIR)$(CGIBINDIR)
mkdir -p $(DESTDIR)$(HTDOCDIR)
- mkdir -p $(DESTDIR)$(WWWPREFIX)/man/mandoc/man1
- mkdir -p $(DESTDIR)$(WWWPREFIX)/man/mandoc/man8
$(INSTALL_PROGRAM) man.cgi $(DESTDIR)$(CGIBINDIR)
$(INSTALL_DATA) mandoc.css $(DESTDIR)$(HTDOCDIR)
- $(INSTALL_MAN) apropos.1 $(DESTDIR)$(WWWPREFIX)/man/mandoc/man1/
- $(INSTALL_MAN) man.cgi.8 $(DESTDIR)$(WWWPREFIX)/man/mandoc/man8/
Makefile.local config.h: configure ${TESTSRCS}
@echo "$@ is out of date; please run ./configure"
diff --git a/cgi.c b/cgi.c
index 1e77a20b..720dbc7d 100644
--- a/cgi.c
+++ b/cgi.c
@@ -1,4 +1,4 @@
-/* $Id: cgi.c,v 1.133 2016/07/09 19:58:36 schwarze Exp $ */
+/* $Id: cgi.c,v 1.134 2016/07/10 10:05:33 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014, 2015, 2016 Ingo Schwarze <schwarze@usta.de>
@@ -470,9 +470,6 @@ validate_manpath(const struct req *req, const char* manpath)
{
size_t i;
- if ( ! strcmp(manpath, "mandoc"))
- return 1;
-
for (i = 0; i < req->psz; i++)
if ( ! strcmp(manpath, req->p[i]))
return 1;
@@ -499,9 +496,9 @@ pg_index(const struct req *req)
resp_searchform(req, FOCUS_QUERY);
printf("<p>\n"
"This web interface is documented in the\n"
- "<a href=\"/%s%smandoc/man8/man.cgi.8\">man.cgi</a>\n"
+ "<a href=\"/%s%sman.cgi.8\">man.cgi(8)</a>\n"
"manual, and the\n"
- "<a href=\"/%s%smandoc/man1/apropos.1\">apropos</a>\n"
+ "<a href=\"/%s%sapropos.1\">apropos(1)</a>\n"
"manual explains the query syntax.\n"
"</p>\n",
scriptname, *scriptname == '\0' ? "" : "/",
@@ -884,12 +881,7 @@ pg_show(struct req *req, const char *fullpath)
free(manpath);
return;
}
-
- if (strcmp(manpath, "mandoc")) {
- free(req->q.manpath);
- req->q.manpath = manpath;
- } else
- free(manpath);
+ free(manpath);
if ( ! validate_filename(file)) {
pg_error_badrequest(
diff --git a/man.cgi.8 b/man.cgi.8
index 7702c4c4..7ed39794 100644
--- a/man.cgi.8
+++ b/man.cgi.8
@@ -1,4 +1,4 @@
-.\" $Id: man.cgi.8,v 1.18 2016/07/07 14:34:41 schwarze Exp $
+.\" $Id: man.cgi.8,v 1.19 2016/07/10 10:05:33 schwarze Exp $
.\"
.\" Copyright (c) 2014, 2015, 2016 Ingo Schwarze <schwarze@openbsd.org>
.\"
@@ -14,7 +14,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: July 7 2016 $
+.Dd $Mdocdate: July 10 2016 $
.Dt MAN.CGI 8
.Os
.Sh NAME
@@ -220,13 +220,16 @@ run
.Pp
.Dl make man.cgi
.Pp
-and copy the files to the proper locations.
-Reading the
-.Cm installcgi
-target in the
-.Pa Makefile
-can help with that, but do not run it without carefully checking it
-because the directory layouts of web servers vary greatly.
+and copy the resulting binary to the proper location,
+for example using the command:
+.Pp
+.Dl make installcgi
+.Pp
+In addition to that, make sure the default manpath contains the files
+.Pa man1/apropos.1
+and
+.Pa man8/man.cgi.8 ,
+or the documentation links at the bottom of the index page will not work.
.Ss URI interface
.Nm
uniform resource identifiers are not needed for interactive use,
@@ -367,10 +370,6 @@ Default
data directory containing all the manual trees.
Can be overridden by
.Dv MAN_DIR .
-.It Pa /man/mandoc/man1/apropos.1 , /man/mandoc/man8/man.cgi.8
-Manual pages documenting
-.Nm
-itself, linked from the index page.
.It Pa /man/manpath.conf
The list of available manpaths, one per line.
If any of the lines in this file contains a slash