1 const char cgisimple_rcs[] = "$Id: cgisimple.c,v 1.9 2001/11/30 23:09:15 jongfoster Exp $";
2 /*********************************************************************
4 * File : $Source: /cvsroot/ijbswa/current/cgisimple.c,v $
6 * Purpose : Simple CGIs to get information about JunkBuster's
9 * Functions declared include:
12 * Copyright : Written by and Copyright (C) 2001 the SourceForge
13 * IJBSWA team. http://ijbswa.sourceforge.net
15 * Based on the Internet Junkbuster originally written
16 * by and Copyright (C) 1997 Anonymous Coders and
17 * Junkbusters Corporation. http://www.junkbusters.com
19 * This program is free software; you can redistribute it
20 * and/or modify it under the terms of the GNU General
21 * Public License as published by the Free Software
22 * Foundation; either version 2 of the License, or (at
23 * your option) any later version.
25 * This program is distributed in the hope that it will
26 * be useful, but WITHOUT ANY WARRANTY; without even the
27 * implied warranty of MERCHANTABILITY or FITNESS FOR A
28 * PARTICULAR PURPOSE. See the GNU General Public
29 * License for more details.
31 * The GNU General Public License should be included with
32 * this file. If not, you can view it at
33 * http://www.gnu.org/copyleft/gpl.html
34 * or write to the Free Software Foundation, Inc., 59
35 * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
38 * $Log: cgisimple.c,v $
39 * Revision 1.9 2001/11/30 23:09:15 jongfoster
40 * Now reports on FEATURE_CGI_EDIT_ACTIONS
41 * Removing FEATURE_DENY_GZIP from template
43 * Revision 1.8 2001/11/13 00:14:07 jongfoster
44 * Fixing stupid bug now I've figured out what || means.
45 * (It always returns 0 or 1, not one of it's paramaters.)
47 * Revision 1.7 2001/10/23 21:48:19 jongfoster
48 * Cleaning up error handling in CGI functions - they now send back
49 * a HTML error page and should never cause a FATAL error. (Fixes one
50 * potential source of "denial of service" attacks).
52 * CGI actions file editor that works and is actually useful.
54 * Ability to toggle JunkBuster remotely using a CGI call.
56 * You can turn off both the above features in the main configuration
57 * file, e.g. if you are running a multi-user proxy.
59 * Revision 1.6 2001/10/14 22:00:32 jongfoster
60 * Adding support for a 404 error when an invalid CGI page is requested.
62 * Revision 1.5 2001/10/07 15:30:41 oes
63 * Removed FEATURE_DENY_GZIP
65 * Revision 1.4 2001/10/02 15:31:12 oes
66 * Introduced show-request cgi
68 * Revision 1.3 2001/09/22 16:34:44 jongfoster
69 * Removing unneeded #includes
71 * Revision 1.2 2001/09/19 18:01:11 oes
72 * Fixed comments; cosmetics
74 * Revision 1.1 2001/09/16 17:08:54 jongfoster
75 * Moving simple CGI functions from cgi.c to new file cgisimple.c
78 **********************************************************************/
84 #include <sys/types.h>
91 #define snprintf _snprintf
92 #endif /* def _WIN32 */
96 #include "cgisimple.h"
102 #include "miscutil.h"
105 #include "urlmatch.h"
107 const char cgisimple_h_rcs[] = CGISIMPLE_H_VERSION;
110 static char *show_rcs(void);
111 static jb_err show_defines(struct map *exports);
114 /*********************************************************************
116 * Function : cgi_default
118 * Description : CGI function that is called if no action was given.
119 * Lists menu of available unhidden CGIs.
122 * 1 : csp = Current client state (buffers, headers, etc...)
123 * 2 : rsp = http_response data structure for output
124 * 3 : parameters = map of cgi parameters
126 * CGI Parameters : none
128 * Returns : JB_ERR_OK on success
129 * JB_ERR_MEMORY on out-of-memory
130 * (Problems other than out-of-memory should be
131 * handled by this routine - it should set the
132 * rsp appropriately and return "success")
134 *********************************************************************/
135 jb_err cgi_default(struct client_state *csp,
136 struct http_response *rsp,
137 const struct map *parameters)
147 if (NULL == (exports = default_exports(csp, "")))
149 return JB_ERR_MEMORY;
152 /* If there were other parameters, export a dump as "cgi-parameters" */
153 if (parameters->first)
155 if (NULL == (p = dump_map(parameters)))
158 return JB_ERR_MEMORY;
160 tmp = strdup("<p>What made you think this cgi takes parameters?\n"
161 "Anyway, here they are, in case you're interested:</p>\n");
162 string_append(&tmp, p);
167 return JB_ERR_MEMORY;
169 if (map(exports, "cgi-parameters", 1, tmp, 0))
171 return JB_ERR_MEMORY;
176 if (map(exports, "cgi-parameters", 1, "", 1))
178 return JB_ERR_MEMORY;
182 return template_fill_for_cgi(csp, "default", exports, rsp);
188 /*********************************************************************
190 * Function : cgi_error_404
192 * Description : CGI function that is called if an unknown action was
196 * 1 : csp = Current client state (buffers, headers, etc...)
197 * 2 : rsp = http_response data structure for output
198 * 3 : parameters = map of cgi parameters
200 * CGI Parameters : none
202 * Returns : JB_ERR_OK on success
203 * JB_ERR_MEMORY on out-of-memory error.
205 *********************************************************************/
206 jb_err cgi_error_404(struct client_state *csp,
207 struct http_response *rsp,
208 const struct map *parameters)
216 if (NULL == (exports = default_exports(csp, NULL)))
218 return JB_ERR_MEMORY;
221 rsp->status = strdup("404 JunkBuster configuration page not found");
222 if (rsp->status == NULL)
225 return JB_ERR_MEMORY;
228 return template_fill_for_cgi(csp, "cgi-error-404", exports, rsp);
232 /*********************************************************************
234 * Function : cgi_show_request
236 * Description : Show the client's request and what sed() would have
240 * 1 : csp = Current client state (buffers, headers, etc...)
241 * 2 : rsp = http_response data structure for output
242 * 3 : parameters = map of cgi parameters
244 * CGI Parameters : none
246 * Returns : JB_ERR_OK on success
247 * JB_ERR_MEMORY on out-of-memory error.
249 *********************************************************************/
250 jb_err cgi_show_request(struct client_state *csp,
251 struct http_response *rsp,
252 const struct map *parameters)
261 if (NULL == (exports = default_exports(csp, "show-request")))
263 return JB_ERR_MEMORY;
267 * Repair the damage done to the IOB by get_header()
269 for (p = csp->iob->buf; p < csp->iob->eod; p++)
271 if (*p == '\0') *p = '\n';
275 * Export the original client's request and the one we would
276 * be sending to the server if this wasn't a CGI call
279 if (map(exports, "client-request", 1, csp->iob->buf, 1))
282 return JB_ERR_MEMORY;
285 if (map(exports, "processed-request", 1, sed(client_patterns, add_client_headers, csp), 0))
288 return JB_ERR_MEMORY;
291 return template_fill_for_cgi(csp, "show-request", exports, rsp);
295 /*********************************************************************
297 * Function : cgi_send_banner
299 * Description : CGI function that returns a banner.
302 * 1 : csp = Current client state (buffers, headers, etc...)
303 * 2 : rsp = http_response data structure for output
304 * 3 : parameters = map of cgi parameters
307 * type : Selects the type of banner between "trans" and "jb".
308 * Defaults to "jb" if absent or != "trans".
310 * Returns : JB_ERR_OK on success
311 * JB_ERR_MEMORY on out-of-memory error.
313 *********************************************************************/
314 jb_err cgi_send_banner(struct client_state *csp,
315 struct http_response *rsp,
316 const struct map *parameters)
318 if (strcmp(lookup(parameters, "type"), "trans"))
320 rsp->body = bindup(image_junkbuster_gif_data, image_junkbuster_gif_length);
321 rsp->content_length = image_junkbuster_gif_length;
325 rsp->body = bindup(image_blank_gif_data, image_blank_gif_length);
326 rsp->content_length = image_blank_gif_length;
329 if (rsp->body == NULL)
331 return JB_ERR_MEMORY;
334 if (enlist(rsp->headers, "Content-Type: image/gif"))
336 return JB_ERR_MEMORY;
346 /*********************************************************************
348 * Function : cgi_show_version
350 * Description : CGI function that returns a a web page describing the
351 * file versions of IJB.
354 * 1 : csp = Current client state (buffers, headers, etc...)
355 * 2 : rsp = http_response data structure for output
356 * 3 : parameters = map of cgi parameters
358 * CGI Parameters : none
360 * Returns : JB_ERR_OK on success
361 * JB_ERR_MEMORY on out-of-memory error.
363 *********************************************************************/
364 jb_err cgi_show_version(struct client_state *csp,
365 struct http_response *rsp,
366 const struct map *parameters)
374 if (NULL == (exports = default_exports(csp, "show-version")))
376 return JB_ERR_MEMORY;
379 if (map(exports, "sourceversions", 1, show_rcs(), 0))
382 return JB_ERR_MEMORY;
385 return template_fill_for_cgi(csp, "show-version", exports, rsp);
389 /*********************************************************************
391 * Function : cgi_show_status
393 * Description : CGI function that returns a a web page describing the
394 * current status of IJB.
397 * 1 : csp = Current client state (buffers, headers, etc...)
398 * 2 : rsp = http_response data structure for output
399 * 3 : parameters = map of cgi parameters
402 * file : Which file to show. Only first letter is checked,
404 * - "p"ermissions (actions) file
407 * Default is to show menu and other information.
409 * Returns : JB_ERR_OK on success
410 * JB_ERR_MEMORY on out-of-memory error.
412 *********************************************************************/
413 jb_err cgi_show_status(struct client_state *csp,
414 struct http_response *rsp,
415 const struct map *parameters)
421 char buf[BUFFER_SIZE];
423 const char * filename = NULL;
424 char * file_description = NULL;
425 #ifdef FEATURE_STATISTICS
426 float perc_rej; /* Percentage of http requests rejected */
428 int local_urls_rejected;
429 #endif /* ndef FEATURE_STATISTICS */
438 if (NULL == (exports = default_exports(csp, "show-status")))
440 return JB_ERR_MEMORY;
443 switch (*(lookup(parameters, "file")))
446 if (csp->actions_list)
448 filename = csp->actions_list->filename;
449 file_description = "Actions List";
456 filename = csp->rlist->filename;
457 file_description = "Regex Filter List";
465 filename = csp->tlist->filename;
466 file_description = "Trust List";
469 #endif /* def FEATURE_TRUST */
472 if (NULL != filename)
474 if ( map(exports, "file-description", 1, file_description, 1)
475 || map(exports, "filepath", 1, html_encode(filename), 0) )
478 return JB_ERR_MEMORY;
481 if ((fp = fopen(filename, "r")) == NULL)
483 if (map(exports, "content", 1, "<h1>ERROR OPENING FILE!</h1>", 1))
486 return JB_ERR_MEMORY;
492 while ((s != NULL) && fgets(buf, sizeof(buf), fp))
494 p = html_encode(buf);
497 string_append(&s, p);
499 string_append(&s, "<br>");
504 if (map(exports, "contents", 1, s, 0))
507 return JB_ERR_MEMORY;
511 return template_fill_for_cgi(csp, "show-status-file", exports, rsp);
514 if (map(exports, "redirect-url", 1, REDIRECT_URL, 1))
517 return JB_ERR_MEMORY;
521 for (i=0; i < Argc; i++)
523 string_append(&s, Argv[i]);
524 string_append(&s, " ");
526 if (map(exports, "invocation", 1, s, 0))
529 return JB_ERR_MEMORY;
532 err = map(exports, "options", 1, csp->config->proxy_args, 1);
533 if (!err) err = show_defines(exports);
535 #ifdef FEATURE_STATISTICS
536 local_urls_read = urls_read;
537 local_urls_rejected = urls_rejected;
540 * Need to alter the stats not to include the fetch of this
543 * Can't do following thread safely! doh!
546 * urls_rejected--; * This will be incremented subsequently *
549 if (local_urls_read == 0)
551 if (!err) err = map_block_killer(exports, "have-stats");
555 if (!err) err = map_block_killer(exports, "have-no-stats");
557 perc_rej = (float)local_urls_rejected * 100.0F /
558 (float)local_urls_read;
560 sprintf(buf, "%d", local_urls_read);
561 if (!err) err = map(exports, "requests-received", 1, buf, 1);
563 sprintf(buf, "%d", local_urls_rejected);
564 if (!err) err = map(exports, "requests-blocked", 1, buf, 1);
566 sprintf(buf, "%6.2f", perc_rej);
567 if (!err) err = map(exports, "percent-blocked", 1, buf, 1);
570 #else /* ndef FEATURE_STATISTICS */
571 err = err || map_block_killer(exports, "statistics");
572 #endif /* ndef FEATURE_STATISTICS */
574 if (csp->actions_list)
576 if (!err) err = map(exports, "actions-filename", 1, csp->actions_list->filename, 1);
580 if (!err) err = map(exports, "actions-filename", 1, "None specified", 1);
585 if (!err) err = map(exports, "re-filter-filename", 1, csp->rlist->filename, 1);
589 if (!err) err = map(exports, "re-filter-filename", 1, "None specified", 1);
595 if (!err) err = map(exports, "trust-filename", 1, csp->tlist->filename, 1);
599 if (!err) err = map(exports, "trust-filename", 1, "None specified", 1);
602 if (!err) err = map_block_killer(exports, "trust-support");
603 #endif /* ndef FEATURE_TRUST */
608 return JB_ERR_MEMORY;
611 return template_fill_for_cgi(csp, "show-status", exports, rsp);
615 /*********************************************************************
617 * Function : cgi_show_url_info
619 * Description : CGI function that determines and shows which actions
620 * junkbuster will perform for a given url, and which
621 * matches starting from the defaults have lead to that.
624 * 1 : csp = Current client state (buffers, headers, etc...)
625 * 2 : rsp = http_response data structure for output
626 * 3 : parameters = map of cgi parameters
629 * url : The url whose actions are to be determined.
630 * If url is unset, the url-given conditional will be
631 * set, so that all but the form can be suppressed in
634 * Returns : JB_ERR_OK on success
635 * JB_ERR_MEMORY on out-of-memory error.
637 *********************************************************************/
638 jb_err cgi_show_url_info(struct client_state *csp,
639 struct http_response *rsp,
640 const struct map *parameters)
650 if (NULL == (exports = default_exports(csp, "show-url-info")))
652 return JB_ERR_MEMORY;
656 * Get the url= parameter (if present) and remove any leading/trailing spaces.
658 url_param = strdup(lookup(parameters, "url"));
659 if (url_param == NULL)
662 return JB_ERR_MEMORY;
667 * Handle prefixes. 4 possibilities:
668 * 1) "http://" or "https://" prefix present and followed by URL - OK
669 * 2) Only the "http://" or "https://" part is present, no URL - change
670 * to empty string so it will be detected later as "no URL".
671 * 3) Parameter specified but doesn't contain "http(s?)://" - add a
673 * 4) Parameter not specified or is empty string - let this fall through
674 * for now, next block of code will handle it.
676 if (0 == strncmp(url_param, "http://", 7))
678 if (url_param[7] == '\0')
681 * Empty URL (just prefix).
682 * Make it totally empty so it's caught by the next if()
687 else if (0 == strncmp(url_param, "https://", 8))
689 if (url_param[8] == '\0')
692 * Empty URL (just prefix).
693 * Make it totally empty so it's caught by the next if()
698 else if (url_param[0] != '\0')
701 * Unknown prefix - assume http://
703 char * url_param_prefixed = malloc(7 + 1 + strlen(url_param));
704 if (NULL == url_param_prefixed)
708 return JB_ERR_MEMORY;
710 strcpy(url_param_prefixed, "http://");
711 strcpy(url_param_prefixed + 7, url_param);
713 url_param = url_param_prefixed;
717 if (url_param[0] == '\0')
719 /* URL paramater not specified, display query form only. */
721 if (map_block_killer(exports, "url-given")
722 || map(exports, "url", 1, "", 1))
725 return JB_ERR_MEMORY;
730 /* Given a URL, so query it. */
735 struct file_list *fl;
736 struct url_actions *b;
737 struct http_request url_to_query[1];
738 struct current_action_spec action[1];
740 if (map(exports, "url", 1, html_encode(url_param), 0))
744 return JB_ERR_MEMORY;
747 init_current_action(action);
749 if (map(exports, "default", 1, current_action_to_text(action), 0))
751 free_current_action(action);
754 return JB_ERR_MEMORY;
757 if (((fl = csp->actions_list) == NULL) || ((b = fl->f) == NULL))
759 err = map(exports, "matches", 1, "none" , 1);
760 if (!err) err = map(exports, "final", 1, lookup(exports, "default"), 1);
762 free_current_action(action);
768 return JB_ERR_MEMORY;
771 return template_fill_for_cgi(csp, "show-url-info", exports, rsp);
774 err = parse_http_url(url_param, url_to_query, csp);
778 if (err == JB_ERR_MEMORY)
780 free_current_action(action);
782 return JB_ERR_MEMORY;
788 err = map(exports, "matches", 1, "<b>[Invalid URL specified!]</b>" , 1);
789 if (!err) err = map(exports, "final", 1, lookup(exports, "default"), 1);
791 free_current_action(action);
796 return JB_ERR_MEMORY;
799 return template_fill_for_cgi(csp, "show-url-info", exports, rsp);
803 * We have a warning about SSL paths. Hide it for insecure sites.
805 if (!url_to_query->ssl)
807 if (map_block_killer(exports, "https"))
809 free_current_action(action);
811 return JB_ERR_MEMORY;
815 matches = strdup("");
817 for (b = b->next; NULL != b; b = b->next)
819 if (url_match(b->url, url_to_query))
821 s = actions_to_text(b->action);
824 free_http_request(url_to_query);
826 free_current_action(action);
828 return JB_ERR_MEMORY;
830 string_append(&matches, "<b>{");
831 string_append(&matches, s);
832 string_append(&matches, " }</b><br>\n<code>");
833 string_append(&matches, b->url->spec);
834 string_append(&matches, "</code><br>\n<br>\n");
837 merge_current_action(action, b->action); /* FIXME: Add error checking */
842 free_http_request(url_to_query);
846 free_current_action(action);
848 return JB_ERR_MEMORY;
854 matches = strdup("none");
856 if (map(exports, "matches", 1, matches , 0))
858 free_current_action(action);
860 return JB_ERR_MEMORY;
863 s = current_action_to_text(action);
865 free_current_action(action);
867 if (map(exports, "final", 1, s, 0))
870 return JB_ERR_MEMORY;
874 return template_fill_for_cgi(csp, "show-url-info", exports, rsp);
878 /*********************************************************************
880 * Function : cgi_robots_txt
882 * Description : CGI function to return "/robots.txt".
885 * 1 : csp = Current client state (buffers, headers, etc...)
886 * 2 : rsp = http_response data structure for output
887 * 3 : parameters = map of cgi parameters
889 * CGI Parameters : None
891 * Returns : JB_ERR_OK on success
892 * JB_ERR_MEMORY on out-of-memory error.
894 *********************************************************************/
895 jb_err cgi_robots_txt(struct client_state *csp,
896 struct http_response *rsp,
897 const struct map *parameters)
903 "# This is the Internet Junkbuster control interface.\n"
904 "# It isn't very useful to index it, and you're likely to break stuff.\n"
910 if (rsp->body == NULL)
912 return JB_ERR_MEMORY;
915 err = enlist_unique(rsp->headers, "Content-Type: text/plain", 13);
919 get_http_time(7 * 24 * 60 * 60, buf); /* 7 days into future */
920 if (!err) err = enlist_unique_header(rsp->headers, "Expires", buf);
922 return (err ? JB_ERR_MEMORY : JB_ERR_OK);
926 /*********************************************************************
928 * Function : show_defines
930 * Description : Add to a map the state od all conditional #defines
934 * 1 : exports = map to extend
936 * Returns : JB_ERR_OK on success
937 * JB_ERR_MEMORY on out-of-memory error.
939 *********************************************************************/
940 static jb_err show_defines(struct map *exports)
942 jb_err err = JB_ERR_OK;
945 if (!err) err = map_conditional(exports, "FEATURE_ACL", 1);
946 #else /* ifndef FEATURE_ACL */
947 if (!err) err = map_conditional(exports, "FEATURE_ACL", 0);
948 #endif /* ndef FEATURE_ACL */
950 #ifdef FEATURE_CGI_EDIT_ACTIONS
951 if (!err) err = map_conditional(exports, "FEATURE_CGI_EDIT_ACTIONS", 1);
952 #else /* ifndef FEATURE_COOKIE_JAR */
953 if (!err) err = map_conditional(exports, "FEATURE_CGI_EDIT_ACTIONS", 0);
954 #endif /* ndef FEATURE_COOKIE_JAR */
956 #ifdef FEATURE_COOKIE_JAR
957 if (!err) err = map_conditional(exports, "FEATURE_COOKIE_JAR", 1);
958 #else /* ifndef FEATURE_COOKIE_JAR */
959 if (!err) err = map_conditional(exports, "FEATURE_COOKIE_JAR", 0);
960 #endif /* ndef FEATURE_COOKIE_JAR */
962 #ifdef FEATURE_FAST_REDIRECTS
963 if (!err) err = map_conditional(exports, "FEATURE_FAST_REDIRECTS", 1);
964 #else /* ifndef FEATURE_FAST_REDIRECTS */
965 if (!err) err = map_conditional(exports, "FEATURE_FAST_REDIRECTS", 0);
966 #endif /* ndef FEATURE_FAST_REDIRECTS */
968 #ifdef FEATURE_FORCE_LOAD
969 if (!err) err = map_conditional(exports, "FEATURE_FORCE_LOAD", 1);
970 #else /* ifndef FEATURE_FORCE_LOAD */
971 if (!err) err = map_conditional(exports, "FEATURE_FORCE_LOAD", 0);
972 #endif /* ndef FEATURE_FORCE_LOAD */
974 #ifdef FEATURE_IMAGE_BLOCKING
975 if (!err) err = map_conditional(exports, "FEATURE_IMAGE_BLOCKING", 1);
976 #else /* ifndef FEATURE_IMAGE_BLOCKING */
977 if (!err) err = map_conditional(exports, "FEATURE_IMAGE_BLOCKING", 0);
978 #endif /* ndef FEATURE_IMAGE_BLOCKING */
980 #ifdef FEATURE_IMAGE_DETECT_MSIE
981 if (!err) err = map_conditional(exports, "FEATURE_IMAGE_DETECT_MSIE", 1);
982 #else /* ifndef FEATURE_IMAGE_DETECT_MSIE */
983 if (!err) err = map_conditional(exports, "FEATURE_IMAGE_DETECT_MSIE", 0);
984 #endif /* ndef FEATURE_IMAGE_DETECT_MSIE */
986 #ifdef FEATURE_KILL_POPUPS
987 if (!err) err = map_conditional(exports, "FEATURE_KILL_POPUPS", 1);
988 #else /* ifndef FEATURE_KILL_POPUPS */
989 if (!err) err = map_conditional(exports, "FEATURE_KILL_POPUPS", 0);
990 #endif /* ndef FEATURE_KILL_POPUPS */
992 #ifdef FEATURE_PTHREAD
993 if (!err) err = map_conditional(exports, "FEATURE_PTHREAD", 1);
994 #else /* ifndef FEATURE_PTHREAD */
995 if (!err) err = map_conditional(exports, "FEATURE_PTHREAD", 0);
996 #endif /* ndef FEATURE_PTHREAD */
998 #ifdef FEATURE_STATISTICS
999 if (!err) err = map_conditional(exports, "FEATURE_STATISTICS", 1);
1000 #else /* ifndef FEATURE_STATISTICS */
1001 if (!err) err = map_conditional(exports, "FEATURE_STATISTICS", 0);
1002 #endif /* ndef FEATURE_STATISTICS */
1004 #ifdef FEATURE_TOGGLE
1005 if (!err) err = map_conditional(exports, "FEATURE_TOGGLE", 1);
1006 #else /* ifndef FEATURE_TOGGLE */
1007 if (!err) err = map_conditional(exports, "FEATURE_TOGGLE", 0);
1008 #endif /* ndef FEATURE_TOGGLE */
1010 #ifdef FEATURE_TRUST
1011 if (!err) err = map_conditional(exports, "FEATURE_TRUST", 1);
1012 #else /* ifndef FEATURE_TRUST */
1013 if (!err) err = map_conditional(exports, "FEATURE_TRUST", 0);
1014 #endif /* ndef FEATURE_TRUST */
1017 if (!err) err = map_conditional(exports, "REGEX_GNU", 1);
1018 #else /* ifndef REGEX_GNU */
1019 if (!err) err = map_conditional(exports, "REGEX_GNU", 0);
1020 #endif /* def REGEX_GNU */
1023 if (!err) err = map_conditional(exports, "REGEX_PCRE", 1);
1024 #else /* ifndef REGEX_PCRE */
1025 if (!err) err = map_conditional(exports, "REGEX_PCRE", 0);
1026 #endif /* def REGEX_PCRE */
1029 if (!err) err = map_conditional(exports, "STATIC_PCRE", 1);
1030 #else /* ifndef STATIC_PCRE */
1031 if (!err) err = map_conditional(exports, "STATIC_PCRE", 0);
1032 #endif /* ndef STATIC_PCRE */
1035 if (!err) err = map_conditional(exports, "STATIC_PCRS", 1);
1036 #else /* ifndef STATIC_PCRS */
1037 if (!err) err = map_conditional(exports, "STATIC_PCRS", 0);
1038 #endif /* ndef STATIC_PCRS */
1040 if (!err) err = map(exports, "FORCE_PREFIX", 1, FORCE_PREFIX, 1);
1046 /*********************************************************************
1048 * Function : show_rcs
1050 * Description : Create a string with the rcs info for all sourcefiles
1054 * Returns : A string, or NULL on out-of-memory.
1056 *********************************************************************/
1057 static char *show_rcs(void)
1059 char *result = strdup("");
1060 char buf[BUFFER_SIZE];
1062 /* Instead of including *all* dot h's in the project (thus creating a
1063 * tremendous amount of dependencies), I will concede to declaring them
1064 * as extern's. This forces the developer to add to this list, but oh well.
1067 #define SHOW_RCS(__x) \
1069 extern const char __x[]; \
1070 sprintf(buf, "%s\n", __x); \
1071 string_append(&result, buf); \
1074 /* In alphabetical order */
1075 SHOW_RCS(actions_h_rcs)
1076 SHOW_RCS(actions_rcs)
1079 #ifdef FEATURE_CGI_EDIT_ACTIONS
1080 SHOW_RCS(cgiedit_h_rcs)
1081 SHOW_RCS(cgiedit_rcs)
1082 #endif /* def FEATURE_CGI_EDIT_ACTIONS */
1083 SHOW_RCS(cgisimple_h_rcs)
1084 SHOW_RCS(cgisimple_rcs)
1086 SHOW_RCS(cygwin_h_rcs)
1088 SHOW_RCS(deanimate_h_rcs)
1089 SHOW_RCS(deanimate_rcs)
1090 SHOW_RCS(encode_h_rcs)
1091 SHOW_RCS(encode_rcs)
1092 SHOW_RCS(errlog_h_rcs)
1093 SHOW_RCS(errlog_rcs)
1094 SHOW_RCS(filters_h_rcs)
1095 SHOW_RCS(filters_rcs)
1096 SHOW_RCS(gateway_h_rcs)
1097 SHOW_RCS(gateway_rcs)
1099 SHOW_RCS(gnu_regex_h_rcs)
1100 SHOW_RCS(gnu_regex_rcs)
1101 #endif /* def GNU_REGEX */
1102 SHOW_RCS(jbsockets_h_rcs)
1103 SHOW_RCS(jbsockets_rcs)
1106 #ifdef FEATURE_KILL_POPUPS
1107 SHOW_RCS(killpopup_h_rcs)
1108 SHOW_RCS(killpopup_rcs)
1109 #endif /* def FEATURE_KILL_POPUPS */
1110 SHOW_RCS(list_h_rcs)
1112 SHOW_RCS(loadcfg_h_rcs)
1113 SHOW_RCS(loadcfg_rcs)
1114 SHOW_RCS(loaders_h_rcs)
1115 SHOW_RCS(loaders_rcs)
1116 SHOW_RCS(miscutil_h_rcs)
1117 SHOW_RCS(miscutil_rcs)
1118 SHOW_RCS(parsers_h_rcs)
1119 SHOW_RCS(parsers_rcs)
1121 SHOW_RCS(pcrs_h_rcs)
1122 SHOW_RCS(project_h_rcs)
1123 SHOW_RCS(ssplit_h_rcs)
1124 SHOW_RCS(ssplit_rcs)
1126 #ifndef _WIN_CONSOLE
1127 SHOW_RCS(w32log_h_rcs)
1128 SHOW_RCS(w32log_rcs)
1129 SHOW_RCS(w32res_h_rcs)
1130 SHOW_RCS(w32taskbar_h_rcs)
1131 SHOW_RCS(w32taskbar_rcs)
1132 #endif /* ndef _WIN_CONSOLE */
1133 SHOW_RCS(win32_h_rcs)
1135 #endif /* def _WIN32 */