From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from krisdoz.my.domain (schwarze@localhost [127.0.0.1]) by krisdoz.my.domain (8.14.5/8.14.5) with ESMTP id s69EJ3hf018353 for ; Wed, 9 Jul 2014 10:19:03 -0400 (EDT) Received: (from schwarze@localhost) by krisdoz.my.domain (8.14.5/8.14.3/Submit) id s69EIxHi000535; Wed, 9 Jul 2014 10:18:59 -0400 (EDT) Date: Wed, 9 Jul 2014 10:18:59 -0400 (EDT) Message-Id: <201407091418.s69EIxHi000535@krisdoz.my.domain> X-Mailinglist: mdocml-source Reply-To: source@mdocml.bsd.lv MIME-Version: 1.0 From: schwarze@mdocml.bsd.lv To: source@mdocml.bsd.lv Subject: mdocml: namespace cleanups: CGI variable: s/CACHE_DIR/MAN_DIR/ because X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Log Message: ----------- namespace cleanups: CGI variable: s/CACHE_DIR/MAN_DIR/ because it's static, not a cache default MAN_DIR: /cache/man.cgi/ -> /man/ see above global variable: s/cache/mandir/ see above global variable: s/css/cssdir/ for consistency with mandir global variable: s/host/httphost/ for consistency with HTTP_HOST global variable: s/progname/scriptname/ for consistency with SCRIPT_NAME struct query: member s/manroot/manpath/ for consistency with QUERY_STRING Modified Files: -------------- mdocml: cgi.c Revision Data ------------- Index: cgi.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/cgi.c,v retrieving revision 1.57 retrieving revision 1.58 diff -Lcgi.c -Lcgi.c -u -p -r1.57 -r1.58 --- cgi.c +++ cgi.c @@ -20,6 +20,7 @@ #endif #include +#include #include #include #include @@ -44,7 +45,7 @@ enum page { * A query as passed to the search function. */ struct query { - const char *manroot; /* manual root directory */ + const char *manpath; /* desired manual directory */ const char *arch; /* architecture */ const char *sec; /* manual section */ const char *expr; /* unparsed expression string */ @@ -52,10 +53,10 @@ struct query { }; struct req { - struct query q; - char **p; /* array of available manroots */ - size_t psz; /* number of available manroots */ - enum page page; + struct query q; + char **p; /* array of available manpaths */ + size_t psz; /* number of available manpaths */ + enum page page; }; static void catman(const struct req *, const char *); @@ -85,10 +86,10 @@ static void resp_search(const struct r struct manpage *, size_t); static void resp_searchform(const struct req *); -static const char *progname; /* cgi script name */ -static const char *cache; /* cache directory */ -static const char *css; /* css directory */ -static const char *host; /* hostname */ +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 */ static const char * const pages[PAGE__MAX] = { "index", /* PAGE_INDEX */ @@ -127,9 +128,9 @@ static void http_printquery(const struct req *req) { - if (NULL != req->q.manroot) { + if (NULL != req->q.manpath) { printf("&manpath="); - http_print(req->q.manroot); + http_print(req->q.manpath); } if (NULL != req->q.sec) { printf("&sec="); @@ -149,9 +150,9 @@ static void html_printquery(const struct req *req) { - if (NULL != req->q.manroot) { + if (NULL != req->q.manpath) { printf("&manpath="); - html_print(req->q.manroot); + html_print(req->q.manpath); } if (NULL != req->q.sec) { printf("&sec="); @@ -203,7 +204,7 @@ http_parse(struct req *req, char *p) int legacy; memset(&req->q, 0, sizeof(struct query)); - req->q.manroot = req->p[0]; + req->q.manpath = req->p[0]; legacy = -1; while ('\0' != *p) { @@ -237,7 +238,7 @@ http_parse(struct req *req, char *p) else if (0 == strcmp(key, "arch")) req->q.arch = val; else if (0 == strcmp(key, "manpath")) - req->q.manroot = val; + req->q.manpath = val; else if (0 == strcmp(key, "apropos")) legacy = 0 == strcmp(val, "0"); } @@ -342,7 +343,8 @@ resp_begin_html(int code, const char *ms "System Manpage Reference\n" "\n" "\n" - "\n", css, css); + "\n", + cssdir, cssdir); } static void @@ -366,7 +368,7 @@ resp_searchform(const struct req *req) " for manuals satisfying \n" "q.expr ? req->q.expr : ""); printf("\">, section " ""); for (i = 0; i < (int)req->psz; i++) { printf("