- * Function : cgi_default
- *
- * Description : CGI function that is called if no action was given.
- * Lists menu of available unhidden CGIs.
- *
- * Parameters :
- * 1 : csp = Current client state (buffers, headers, etc...)
- * 2 : rsp = http_response data structure for output
- * 3 : parameters = map of cgi parameters
- *
- * Returns : 0
- *
- *********************************************************************/
-int cgi_default(struct client_state *csp, struct http_response *rsp,
- struct map *parameters)
-{
- char *p, *tmp = NULL;
- struct map *exports = default_exports(csp, "");
-
- /* If there were other parameters, export a dump as "cgi-parameters" */
- if(parameters)
- {
- p = dump_map(parameters);
- tmp = strsav(tmp, "<p>What made you think this cgi takes parameters?\n"
- "Anyway, here they are, in case you're interested:</p>\n");
- tmp = strsav(tmp, p);
- exports = map(exports, "cgi-parameters", 1, tmp, 0);
- free(p);
- }
- else
- {
- exports = map(exports, "cgi-parameters", 1, "", 1);
- }
-
- rsp->body = fill_template(csp, "default", exports);
- free_map(exports);
- return(0);
-
-}
-
-
-/*********************************************************************
- *
- * Function : cgi_send_banner
- *
- * Description : CGI function that returns a banner.
- *
- * Parameters :
- * 1 : csp = Current client state (buffers, headers, etc...)
- * 2 : rsp = http_response data structure for output
- * 3 : parameters = map of cgi parameters
- *
- * CGI Parameters :
- * type : Selects the type of banner between "trans" and "jb".
- * Defaults to "jb" if absent or != "trans".
- *
- * Returns : 0
- *
- *********************************************************************/
-int cgi_send_banner(struct client_state *csp, struct http_response *rsp,
- struct map *parameters)
-{
- if(strcmp(lookup(parameters, "type"), "trans"))
- {
- rsp->body = bindup(JBGIF, sizeof(JBGIF));
- rsp->content_length = sizeof(JBGIF);
- }
- else
- {
- rsp->body = bindup(BLANKGIF, sizeof(BLANKGIF));
- rsp->content_length = sizeof(BLANKGIF);
- }
-
- enlist(rsp->headers, "Content-Type: image/gif");
-
- return(0);
-
-}
-
-
-/*********************************************************************
- *
- * Function : cgi_show_version
- *
- * Description : CGI function that returns a a web page describing the
- * file versions of IJB.
- *
- * Parameters :
- * 1 : csp = Current client state (buffers, headers, etc...)
- * 2 : rsp = http_response data structure for output
- * 3 : parameters = map of cgi parameters
- *
- * CGI Parameters :
- * type : Selects the type of banner between "trans" and "jb".
- * Defaults to "jb" if absent or != "trans".
- *
- * Returns : 0
- *
- *********************************************************************/
-int cgi_show_version(struct client_state *csp, struct http_response *rsp,
- struct map *parameters)
-{
- struct map *exports = default_exports(csp, "show-version");
-
- exports = map(exports, "sourceversions", 1, show_rcs(), 0);
-
- rsp->body = fill_template(csp, "show-version", exports);
- free_map(exports);
- return(0);
-
-}
-
-
-/*********************************************************************
- *
- * Function : cgi_show_status