summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2016-04-15 21:14:51 +0000
committerIngo Schwarze <schwarze@openbsd.org>2016-04-15 21:14:51 +0000
commit8bc30dd37f404fdb0b145b0b431a29e3962effc5 (patch)
tree6636d206046d77ed9ec5a6a0c93ed7ec87042f6d
parentc2a16fda9691f4ed3a134a63ee87e2a280da6dc3 (diff)
downloadmandoc-8bc30dd37f404fdb0b145b0b431a29e3962effc5.tar.gz
Rename five static functions to make the classification of functions
as parsers, page generators, and result generators more obvious. No functional change.
-rw-r--r--cgi.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/cgi.c b/cgi.c
index 64d1cbd1..ef76fb52 100644
--- a/cgi.c
+++ b/cgi.c
@@ -59,14 +59,12 @@ struct req {
int isquery; /* QUERY_STRING used, not PATH_INFO */
};
-static void catman(const struct req *, const char *);
-static void format(const struct req *, const char *);
static void html_print(const char *);
static void html_putchar(char);
static int http_decode(char *);
-static void http_parse(struct req *, const char *);
-static void pathgen(struct req *);
-static void path_parse(struct req *req, const char *path);
+static void parse_manpath_conf(struct req *);
+static void parse_path_info(struct req *req, const char *path);
+static void parse_query_string(struct req *, const char *);
static void pg_error_badrequest(const char *);
static void pg_error_internal(void);
static void pg_index(const struct req *);
@@ -77,8 +75,10 @@ static void pg_searchres(const struct req *,
static void pg_show(struct req *, const char *);
static void resp_begin_html(int, const char *);
static void resp_begin_http(int, const char *);
+static void resp_catman(const struct req *, const char *);
static void resp_copy(const char *);
static void resp_end_html(void);
+static void resp_format(const struct req *, const char *);
static void resp_searchform(const struct req *);
static void resp_show(const struct req *, const char *);
static void set_query_attr(char **, char **);
@@ -185,7 +185,7 @@ set_query_attr(char **attr, char **val)
* and store the values into the query structure.
*/
static void
-http_parse(struct req *req, const char *qs)
+parse_query_string(struct req *req, const char *qs)
{
char *key, *val;
size_t keysz, valsz;
@@ -661,7 +661,7 @@ pg_searchres(const struct req *req, struct manpage *r, size_t sz)
}
static void
-catman(const struct req *req, const char *file)
+resp_catman(const struct req *req, const char *file)
{
FILE *f;
char *p;
@@ -798,7 +798,7 @@ catman(const struct req *req, const char *file)
}
static void
-format(const struct req *req, const char *file)
+resp_format(const struct req *req, const char *file)
{
struct manoutput conf;
struct mparse *mp;
@@ -856,9 +856,9 @@ resp_show(const struct req *req, const char *file)
file += 2;
if ('c' == *file)
- catman(req, file);
+ resp_catman(req, file);
else
- format(req, file);
+ resp_format(req, file);
}
static void
@@ -1025,7 +1025,7 @@ main(void)
memset(&req, 0, sizeof(struct req));
req.q.equal = 1;
- pathgen(&req);
+ parse_manpath_conf(&req);
/* Parse the path info and the query string. */
@@ -1035,11 +1035,11 @@ main(void)
path++;
if (*path != '\0') {
- path_parse(&req, path);
+ parse_path_info(&req, path);
if (access(path, F_OK) == -1)
path = "";
} else if ((querystring = getenv("QUERY_STRING")) != NULL)
- http_parse(&req, querystring);
+ parse_query_string(&req, querystring);
/* Validate parsed data and add defaults. */
@@ -1080,7 +1080,7 @@ main(void)
* If PATH_INFO is not a file name, translate it to a query.
*/
static void
-path_parse(struct req *req, const char *path)
+parse_path_info(struct req *req, const char *path)
{
char *dir;
@@ -1132,7 +1132,7 @@ path_parse(struct req *req, const char *path)
* Scan for indexable paths.
*/
static void
-pathgen(struct req *req)
+parse_manpath_conf(struct req *req)
{
FILE *fp;
char *dp;