aboutsummaryrefslogtreecommitdiffstatshomepage
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
commita13b622558b6813cf3255a3ee6c3925c5e7f80b9 (patch)
treedef5499beb2a701689a490ce70647e905e0a224e
parent27fbf6eabd2fbc056583cf32ed982ea83d97641a (diff)
downloadmandoc-a13b622558b6813cf3255a3ee6c3925c5e7f80b9.tar.gz
mandoc-a13b622558b6813cf3255a3ee6c3925c5e7f80b9.tar.zst
mandoc-a13b622558b6813cf3255a3ee6c3925c5e7f80b9.zip
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.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/cgi.c b/cgi.c
index f6721c0b..41e4984d 100644
--- a/cgi.c
+++ b/cgi.c
@@ -1,4 +1,4 @@
-/* $Id: cgi.c,v 1.128 2016/04/15 16:42:52 schwarze Exp $ */
+/* $Id: cgi.c,v 1.129 2016/04/15 21:14:51 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014, 2015, 2016 Ingo Schwarze <schwarze@usta.de>
@@ -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;