=================================================================== RCS file: /cvs/mandoc/cgi.c,v retrieving revision 1.66 retrieving revision 1.67 diff -u -p -r1.66 -r1.67 --- mandoc/cgi.c 2014/07/12 17:21:45 1.66 +++ mandoc/cgi.c 2014/07/12 18:32:47 1.67 @@ -1,4 +1,4 @@ -/* $Id: cgi.c,v 1.66 2014/07/12 17:21:45 schwarze Exp $ */ +/* $Id: cgi.c,v 1.67 2014/07/12 18:32:47 schwarze Exp $ */ /* * Copyright (c) 2011, 2012 Kristaps Dzonsons * Copyright (c) 2014 Ingo Schwarze @@ -33,6 +33,7 @@ #include "main.h" #include "manpath.h" #include "mansearch.h" +#include "cgi.h" /* * A query as passed to the search function. @@ -78,8 +79,6 @@ static void resp_search(const struct req *, static void resp_searchform(const struct req *); static const char *scriptname; /* CGI script name */ -static const char *mandir; /* contains all manpath directories */ -static const char *cssdir; /* css directory */ static const char *httphost; /* hostname used in the URIs */ /* @@ -314,11 +313,11 @@ resp_begin_html(int code, const char *msg) " TYPE=\"text/css\" media=\"all\">\n" "\n" - "System Manpage Reference\n" + "%s\n" "\n" "\n" "\n", - cssdir, cssdir); + CSS_DIR, CSS_DIR, CUSTOMIZE_TITLE); } static void @@ -334,6 +333,7 @@ resp_searchform(const struct req *req) { int i; + puts(CUSTOMIZE_BEGIN); puts(""); printf("
\n" "
\n" @@ -391,10 +391,6 @@ resp_index(const struct req *req) { resp_begin_html(200, NULL); - puts("

\n" - "Online manuals with " - "mandoc\n" - "

"); resp_searchform(req); printf("

\n" "This web interface is documented in the " @@ -801,27 +797,21 @@ main(void) /* Scan our run-time environment. */ - if (NULL == (mandir = getenv("MAN_DIR"))) - mandir = "/man"; - if (NULL == (scriptname = getenv("SCRIPT_NAME"))) scriptname = ""; - if (NULL == (cssdir = getenv("CSS_DIR"))) - cssdir = ""; - if (NULL == (httphost = getenv("HTTP_HOST"))) httphost = "localhost"; /* - * First we change directory into the mandir so that + * First we change directory into the MAN_DIR so that * subsequent scanning for manpath directories is rooted * relative to the same position. */ - if (-1 == chdir(mandir)) { + if (-1 == chdir(MAN_DIR)) { fprintf(stderr, "MAN_DIR: %s: %s\n", - mandir, strerror(errno)); + MAN_DIR, strerror(errno)); resp_error_internal(); return(EXIT_FAILURE); }