c3de94622cb6aa6f0595db3c8cb81274a049be8d
[privoxy.git] / src / cgisimple.c
1 const char cgisimple_rcs[] = "$Id: cgisimple.c,v 2.1 2002/07/04 14:35:05 oes Exp $";
2 /*********************************************************************
3  *
4  * File        :  $Source: /cvsroot/ijbswa/current/src/cgisimple.c,v $
5  *
6  * Purpose     :  Simple CGIs to get information about Privoxy's
7  *                status.
8  *                
9  *                Functions declared include:
10  * 
11  *
12  * Copyright   :  Written by and Copyright (C) 2001 the SourceForge
13  *                Privoxy team. http://www.privoxy.org/
14  *
15  *                Based on the Internet Junkbuster originally written
16  *                by and Copyright (C) 1997 Anonymous Coders and 
17  *                Junkbusters Corporation.  http://www.junkbusters.com
18  *
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.
24  *
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.
30  *
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.
36  *
37  * Revisions   :
38  *    $Log: cgisimple.c,v $
39  *    Revision 2.1  2002/07/04 14:35:05  oes
40  *    Added ability to send redirects to send-banner CGI, so that it can completely mimic the image blocking action if called with type=auto
41  *
42  *    Revision 2.0  2002/06/04 14:34:21  jongfoster
43  *    Moving source files to src/
44  *
45  *    Revision 1.35  2002/05/12 21:44:44  jongfoster
46  *    Adding amiga.[ch] revision information, if on an amiga.
47  *
48  *    Revision 1.34  2002/04/30 12:06:12  oes
49  *    Deleted unused code from default_cgi
50  *
51  *    Revision 1.33  2002/04/30 11:14:52  oes
52  *    Made csp the first parameter in *action_to_html
53  *
54  *    Revision 1.32  2002/04/26 18:29:13  jongfoster
55  *    Fixing this Visual C++ warning:
56  *    cgisimple.c(775) : warning C4018: '<' : signed/unsigned mismatch
57  *
58  *    Revision 1.31  2002/04/26 12:54:36  oes
59  *     - Kill obsolete REDIRECT_URL code
60  *     - Error handling fixes
61  *     - Style sheet related HTML snipplet changes
62  *     - cgi_show_url_info:
63  *       - Matches now in table, actions on single lines,
64  *         linked to help
65  *       - standard.action suppressed
66  *       - Buttons to View and Edit AFs
67  *
68  *    Revision 1.30  2002/04/24 02:18:08  oes
69  *     - show-status is now the starting point for editing
70  *       the actions files, generate list of all AFs with buttons
71  *       for viewing and editing, new look for file list (Jon:
72  *       buttons now aligned ;-P ), view mode now supports multiple
73  *       AFs, name changes, no view links for unspecified files,
74  *       no edit link for standard.action.
75  *
76  *     - Jon's multiple AF patch: cgi_show_url_info now uses all
77  *       AFs and marks the output accordingly
78  *
79  *    Revision 1.29  2002/04/10 13:38:35  oes
80  *    load_template signature changed
81  *
82  *    Revision 1.28  2002/04/07 15:42:12  jongfoster
83  *    Fixing send-banner?type=auto when the image-blocker is
84  *    a redirect to send-banner
85  *
86  *    Revision 1.27  2002/04/05 15:50:48  oes
87  *    added send-stylesheet CGI
88  *
89  *    Revision 1.26  2002/04/04 00:36:36  gliptak
90  *    always use pcre for matching
91  *
92  *    Revision 1.25  2002/04/03 22:28:03  gliptak
93  *    Removed references to gnu_regex
94  *
95  *    Revision 1.24  2002/04/02 16:12:47  oes
96  *    Fix: moving misplaced lines into #ifdef FEATURE_FORCE
97  *
98  *    Revision 1.23  2002/03/26 22:29:54  swa
99  *    we have a new homepage!
100  *
101  *    Revision 1.22  2002/03/24 16:18:15  jongfoster
102  *    Removing old logo
103  *
104  *    Revision 1.21  2002/03/24 15:23:33  jongfoster
105  *    Name changes
106  *
107  *    Revision 1.20  2002/03/24 13:25:43  swa
108  *    name change related issues
109  *
110  *    Revision 1.19  2002/03/16 23:54:06  jongfoster
111  *    Adding graceful termination feature, to help look for memory leaks.
112  *    If you enable this (which, by design, has to be done by hand
113  *    editing config.h) and then go to http://i.j.b/die, then the program
114  *    will exit cleanly after the *next* request.  It should free all the
115  *    memory that was used.
116  *
117  *    Revision 1.18  2002/03/12 01:44:49  oes
118  *    Changed default for "blocked" image from jb logo to checkboard pattern
119  *
120  *    Revision 1.17  2002/03/08 16:43:18  oes
121  *    Added choice beween GIF and PNG built-in images
122  *
123  *    Revision 1.16  2002/03/07 03:48:38  oes
124  *     - Changed built-in images from GIF to PNG
125  *       (with regard to Unisys patent issue)
126  *     - Added a 4x4 pattern PNG which is less intrusive
127  *       than the logo but also clearly marks the deleted banners
128  *
129  *    Revision 1.15  2002/03/06 22:54:35  jongfoster
130  *    Automated function-comment nitpicking.
131  *
132  *    Revision 1.14  2002/03/02 04:14:50  david__schmidt
133  *    Clean up a little CRLF unpleasantness that suddenly appeared
134  *
135  *    Revision 1.13  2002/02/21 00:10:37  jongfoster
136  *    Adding send-banner?type=auto option
137  *
138  *    Revision 1.12  2002/01/23 01:03:32  jongfoster
139  *    Fixing gcc [CygWin] compiler warnings
140  *
141  *    Revision 1.11  2002/01/23 00:01:04  jongfoster
142  *    Adding cgi_transparent_gif() for http://i.j.b/t
143  *    Adding missing html_encode() to many CGI functions.
144  *    Adding urlmatch.[ch] to http://i.j.b/show-version
145  *
146  *    Revision 1.10  2002/01/17 21:10:37  jongfoster
147  *    Changes to cgi_show_url_info to use new matching code from urlmatch.c.
148  *    Also fixing a problem in the same function with improperly quoted URLs
149  *    in output HTML, and adding code to handle https:// URLs correctly.
150  *
151  *    Revision 1.9  2001/11/30 23:09:15  jongfoster
152  *    Now reports on FEATURE_CGI_EDIT_ACTIONS
153  *    Removing FEATURE_DENY_GZIP from template
154  *
155  *    Revision 1.8  2001/11/13 00:14:07  jongfoster
156  *    Fixing stupid bug now I've figured out what || means.
157  *    (It always returns 0 or 1, not one of it's paramaters.)
158  *
159  *    Revision 1.7  2001/10/23 21:48:19  jongfoster
160  *    Cleaning up error handling in CGI functions - they now send back
161  *    a HTML error page and should never cause a FATAL error.  (Fixes one
162  *    potential source of "denial of service" attacks).
163  *
164  *    CGI actions file editor that works and is actually useful.
165  *
166  *    Ability to toggle JunkBuster remotely using a CGI call.
167  *
168  *    You can turn off both the above features in the main configuration
169  *    file, e.g. if you are running a multi-user proxy.
170  *
171  *    Revision 1.6  2001/10/14 22:00:32  jongfoster
172  *    Adding support for a 404 error when an invalid CGI page is requested.
173  *
174  *    Revision 1.5  2001/10/07 15:30:41  oes
175  *    Removed FEATURE_DENY_GZIP
176  *
177  *    Revision 1.4  2001/10/02 15:31:12  oes
178  *    Introduced show-request cgi
179  *
180  *    Revision 1.3  2001/09/22 16:34:44  jongfoster
181  *    Removing unneeded #includes
182  *
183  *    Revision 1.2  2001/09/19 18:01:11  oes
184  *    Fixed comments; cosmetics
185  *
186  *    Revision 1.1  2001/09/16 17:08:54  jongfoster
187  *    Moving simple CGI functions from cgi.c to new file cgisimple.c
188  *
189  *
190  **********************************************************************/
191 \f
192
193 #include "config.h"
194
195 #include <stdio.h>
196 #include <sys/types.h>
197 #include <stdlib.h>
198 #include <ctype.h>
199 #include <string.h>
200 #include <assert.h>
201
202 #ifdef _WIN32
203 #define snprintf _snprintf
204 #endif /* def _WIN32 */
205
206 #include "project.h"
207 #include "cgi.h"
208 #include "cgisimple.h"
209 #include "list.h"
210 #include "encode.h"
211 #include "jcc.h"
212 #include "filters.h"
213 #include "actions.h"
214 #include "miscutil.h"
215 #include "loadcfg.h"
216 #include "parsers.h"
217 #include "urlmatch.h"
218 #include "errlog.h"
219
220 const char cgisimple_h_rcs[] = CGISIMPLE_H_VERSION;
221
222
223 static char *show_rcs(void);
224 static jb_err show_defines(struct map *exports);
225
226
227 /*********************************************************************
228  *
229  * Function    :  cgi_default
230  *
231  * Description :  CGI function that is called for the CGI_SITE_1_HOST
232  *                and CGI_SITE_2_HOST/CGI_SITE_2_PATH base URLs.
233  *                Boring - only exports the default exports.
234  *               
235  * Parameters  :
236  *          1  :  csp = Current client state (buffers, headers, etc...)
237  *          2  :  rsp = http_response data structure for output
238  *          3  :  parameters = map of cgi parameters
239  *
240  * CGI Parameters : none
241  *
242  * Returns     :  JB_ERR_OK on success
243  *                JB_ERR_MEMORY on out-of-memory
244  *
245  *********************************************************************/
246 jb_err cgi_default(struct client_state *csp,
247                    struct http_response *rsp,
248                    const struct map *parameters)
249 {
250    struct map *exports;
251
252    assert(csp);
253    assert(rsp);
254
255    if (NULL == (exports = default_exports(csp, "")))
256    {
257       return JB_ERR_MEMORY;
258    }
259
260    return template_fill_for_cgi(csp, "default", exports, rsp);
261 }
262
263
264 /*********************************************************************
265  *
266  * Function    :  cgi_error_404
267  *
268  * Description :  CGI function that is called if an unknown action was
269  *                given.
270  *               
271  * Parameters  :
272  *          1  :  csp = Current client state (buffers, headers, etc...)
273  *          2  :  rsp = http_response data structure for output
274  *          3  :  parameters = map of cgi parameters
275  *
276  * CGI Parameters : none
277  *
278  * Returns     :  JB_ERR_OK on success
279  *                JB_ERR_MEMORY on out-of-memory error.  
280  *
281  *********************************************************************/
282 jb_err cgi_error_404(struct client_state *csp,
283                      struct http_response *rsp,
284                      const struct map *parameters)
285 {
286    struct map *exports;
287
288    assert(csp);
289    assert(rsp);
290    assert(parameters);
291
292    if (NULL == (exports = default_exports(csp, NULL)))
293    {
294       return JB_ERR_MEMORY;
295    }
296
297    rsp->status = strdup("404 Privoxy configuration page not found");
298    if (rsp->status == NULL)
299    {
300       free_map(exports);
301       return JB_ERR_MEMORY;
302    }
303
304    return template_fill_for_cgi(csp, "cgi-error-404", exports, rsp);
305 }
306
307
308 #ifdef FEATURE_GRACEFUL_TERMINATION
309 /*********************************************************************
310  *
311  * Function    :  cgi_die
312  *
313  * Description :  CGI function to shut down Privoxy.
314  *                NOTE: Turning this on in a production build
315  *                would be a BAD idea.  An EXTREMELY BAD idea.
316  *                In short, don't do it.
317  *               
318  * Parameters  :
319  *          1  :  csp = Current client state (buffers, headers, etc...)
320  *          2  :  rsp = http_response data structure for output
321  *          3  :  parameters = map of cgi parameters
322  *
323  * CGI Parameters : none
324  *
325  * Returns     :  JB_ERR_OK on success
326  *                JB_ERR_MEMORY on out-of-memory error.  
327  *
328  *********************************************************************/
329 jb_err cgi_die (struct client_state *csp,
330                 struct http_response *rsp,
331                 const struct map *parameters)
332 {
333    assert(csp);
334    assert(rsp);
335    assert(parameters);
336
337    /* quit */
338    g_terminate = 1;
339
340    /*
341     * I don't really care what gets sent back to the browser.
342     * Take the easy option - "out of memory" page.
343     */
344
345    return JB_ERR_MEMORY;
346 }
347 #endif /* def FEATURE_GRACEFUL_TERMINATION */
348
349
350 /*********************************************************************
351  *
352  * Function    :  cgi_show_request
353  *
354  * Description :  Show the client's request and what sed() would have
355  *                made of it.
356  *               
357  * Parameters  :
358  *          1  :  csp = Current client state (buffers, headers, etc...)
359  *          2  :  rsp = http_response data structure for output
360  *          3  :  parameters = map of cgi parameters
361  *
362  * CGI Parameters : none
363  *
364  * Returns     :  JB_ERR_OK on success
365  *                JB_ERR_MEMORY on out-of-memory error.  
366  *
367  *********************************************************************/
368 jb_err cgi_show_request(struct client_state *csp,
369                         struct http_response *rsp,
370                         const struct map *parameters)
371 {
372    char *p;
373    struct map *exports;
374
375    assert(csp);
376    assert(rsp);
377    assert(parameters);
378
379    if (NULL == (exports = default_exports(csp, "show-request")))
380    {
381       return JB_ERR_MEMORY;
382    }
383    
384    /*
385     * Repair the damage done to the IOB by get_header()
386     */
387    for (p = csp->iob->buf; p < csp->iob->eod; p++)
388    {
389       if (*p == '\0') *p = '\n';
390    }
391
392    /*
393     * Export the original client's request and the one we would
394     * be sending to the server if this wasn't a CGI call
395     */
396
397    if (map(exports, "client-request", 1, html_encode(csp->iob->buf), 0))
398    {
399       free_map(exports);
400       return JB_ERR_MEMORY;
401    }
402
403    if (map(exports, "processed-request", 1, html_encode_and_free_original(
404       sed(client_patterns, add_client_headers, csp)), 0))
405    {
406       free_map(exports);
407       return JB_ERR_MEMORY;
408    }
409
410    return template_fill_for_cgi(csp, "show-request", exports, rsp);
411 }
412
413
414 /*********************************************************************
415  *
416  * Function    :  cgi_send_banner
417  *
418  * Description :  CGI function that returns a banner. 
419  *
420  * Parameters  :
421  *          1  :  csp = Current client state (buffers, headers, etc...)
422  *          2  :  rsp = http_response data structure for output
423  *          3  :  parameters = map of cgi parameters
424  *
425  * CGI Parameters :
426  *           type : Selects the type of banner between "trans", "logo",
427  *                  and "auto". Defaults to "logo" if absent or invalid.
428  *                  "auto" means to select as if we were image-blocking.
429  *                  (Only the first character really counts; b and t are
430  *                  equivalent).
431  *
432  * Returns     :  JB_ERR_OK on success
433  *                JB_ERR_MEMORY on out-of-memory error.  
434  *
435  *********************************************************************/
436 jb_err cgi_send_banner(struct client_state *csp,
437                        struct http_response *rsp,
438                        const struct map *parameters)
439 {
440    char imagetype = lookup(parameters, "type")[0];
441
442    /*
443     * If type is auto, then determine the right thing
444     * to do from the set-image-blocker action
445     */
446    if (imagetype == 'a') 
447    {
448       /*
449        * Default to pattern
450        */
451       imagetype = 'p';
452
453 #ifdef FEATURE_IMAGE_BLOCKING
454       if ((csp->action->flags & ACTION_IMAGE_BLOCKER) != 0)
455       {
456          static const char prefix1[] = CGI_PREFIX "send-banner?type=";
457          static const char prefix2[] = "http://" CGI_SITE_1_HOST "/send-banner?type=";
458          const char *p = csp->action->string[ACTION_STRING_IMAGE_BLOCKER];
459
460          if (p == NULL)
461          {
462             /* Use default - nothing to do here. */
463          }
464          else if (0 == strcmpic(p, "blank"))
465          {
466             imagetype = 'b';
467          }
468          else if (0 == strcmpic(p, "pattern"))
469          {
470             imagetype = 'p';
471          }
472
473          /*
474           * If the action is to call this CGI, determine
475           * the argument:
476           */
477          else if (0 == strncmpic(p, prefix1, sizeof(prefix1) - 1))
478          {
479             imagetype = p[sizeof(prefix1) - 1];
480          }
481          else if (0 == strncmpic(p, prefix2, sizeof(prefix2) - 1))
482          {
483             imagetype = p[sizeof(prefix2) - 1];
484          }
485
486          /*
487           * Everything else must (should) be a URL to
488           * redirect to.
489           */
490          else
491          {
492             imagetype = 'r';
493          }
494       }
495 #endif /* def FEATURE_IMAGE_BLOCKING */
496    }
497       
498    /*
499     * Now imagetype is either the non-auto type we were called with,
500     * or it was auto and has since been determined. In any case, we
501     * can proceed to actually answering the request by sending a redirect
502     * or an image as appropriate:
503     */
504    if (imagetype == 'r') 
505    {
506       rsp->status = strdup("302 Local Redirect from Privoxy");
507       if (rsp->status == NULL)
508       {
509          return JB_ERR_MEMORY;
510       }
511       if (enlist_unique_header(rsp->headers, "Location",
512                                csp->action->string[ACTION_STRING_IMAGE_BLOCKER]))
513       {
514          return JB_ERR_MEMORY;
515       }
516    }
517    else
518    {
519       if ((imagetype == 'b') || (imagetype == 't')) 
520       {
521          rsp->body = bindup(image_blank_data, image_blank_length);
522          rsp->content_length = image_blank_length;
523       }
524       else
525       {
526          rsp->body = bindup(image_pattern_data, image_pattern_length);
527          rsp->content_length = image_pattern_length;
528       }
529
530       if (rsp->body == NULL)
531       {
532          return JB_ERR_MEMORY;
533       }
534       if (enlist(rsp->headers, "Content-Type: " BUILTIN_IMAGE_MIMETYPE))
535       {
536          return JB_ERR_MEMORY;
537       }
538
539       rsp->is_static = 1;
540    }
541
542    return JB_ERR_OK;
543
544 }
545
546
547 /*********************************************************************
548  *
549  * Function    :  cgi_transparent_image
550  *
551  * Description :  CGI function that sends a 1x1 transparent image.
552  *
553  * Parameters  :
554  *          1  :  csp = Current client state (buffers, headers, etc...)
555  *          2  :  rsp = http_response data structure for output
556  *          3  :  parameters = map of cgi parameters
557  *
558  * CGI Parameters : None
559  *
560  * Returns     :  JB_ERR_OK on success
561  *                JB_ERR_MEMORY on out-of-memory error.  
562  *
563  *********************************************************************/
564 jb_err cgi_transparent_image(struct client_state *csp,
565                              struct http_response *rsp,
566                              const struct map *parameters)
567 {
568    rsp->body = bindup(image_blank_data, image_blank_length);
569    rsp->content_length = image_blank_length;
570
571    if (rsp->body == NULL)
572    {
573       return JB_ERR_MEMORY;
574    }
575
576    if (enlist(rsp->headers, "Content-Type: " BUILTIN_IMAGE_MIMETYPE))
577    {
578       return JB_ERR_MEMORY;
579    }
580
581    rsp->is_static = 1;
582
583    return JB_ERR_OK;
584
585 }
586
587
588 /*********************************************************************
589  *
590  * Function    :  cgi_send_stylesheet
591  *
592  * Description :  CGI function that sends a css stylesheet found
593  *                in the cgi-style.css template
594  *
595  * Parameters  :
596  *          1  :  csp = Current client state (buffers, headers, etc...)
597  *          2  :  rsp = http_response data structure for output
598  *          3  :  parameters = map of cgi parameters
599  *
600  * CGI Parameters : None
601  *
602  * Returns     :  JB_ERR_OK on success
603  *                JB_ERR_MEMORY on out-of-memory error.  
604  *
605  *********************************************************************/
606 jb_err cgi_send_stylesheet(struct client_state *csp,
607                            struct http_response *rsp,
608                            const struct map *parameters)
609 {
610    jb_err err;
611    
612    assert(csp);
613    assert(rsp);
614
615    err = template_load(csp, &rsp->body, "cgi-style.css", 0);
616
617    if (err == JB_ERR_FILE)
618    {
619       /*
620        * No way to tell user; send empty stylesheet
621        */
622       log_error(LOG_LEVEL_ERROR, "Could not find cgi-style.css template");
623    }
624    else if (err)
625    {
626       return err; /* JB_ERR_MEMORY */
627    }
628
629    if (enlist(rsp->headers, "Content-Type: text/css"))
630    {
631       return JB_ERR_MEMORY;
632    }
633
634    return JB_ERR_OK;
635
636 }
637
638
639 /*********************************************************************
640  *
641  * Function    :  cgi_show_version
642  *
643  * Description :  CGI function that returns a a web page describing the
644  *                file versions of Privoxy.
645  *
646  * Parameters  :
647  *          1  :  csp = Current client state (buffers, headers, etc...)
648  *          2  :  rsp = http_response data structure for output
649  *          3  :  parameters = map of cgi parameters
650  *
651  * CGI Parameters : none
652  *
653  * Returns     :  JB_ERR_OK on success
654  *                JB_ERR_MEMORY on out-of-memory error.  
655  *
656  *********************************************************************/
657 jb_err cgi_show_version(struct client_state *csp,
658                         struct http_response *rsp,
659                         const struct map *parameters)
660 {
661    struct map *exports;
662
663    assert(csp);
664    assert(rsp);
665    assert(parameters);
666
667    if (NULL == (exports = default_exports(csp, "show-version")))
668    {
669       return JB_ERR_MEMORY;
670    }
671
672    if (map(exports, "sourceversions", 1, show_rcs(), 0))
673    {
674       free_map(exports);
675       return JB_ERR_MEMORY;
676    }
677
678    return template_fill_for_cgi(csp, "show-version", exports, rsp);
679 }
680
681  
682 /*********************************************************************
683  *
684  * Function    :  cgi_show_status
685  *
686  * Description :  CGI function that returns a a web page describing the
687  *                current status of Privoxy.
688  *
689  * Parameters  :
690  *          1  :  csp = Current client state (buffers, headers, etc...)
691  *          2  :  rsp = http_response data structure for output
692  *          3  :  parameters = map of cgi parameters
693  *
694  * CGI Parameters :
695  *        file :  Which file to show.  Only first letter is checked,
696  *                valid values are:
697  *                - "p"ermissions (actions) file
698  *                - "r"egex
699  *                - "t"rust
700  *                Default is to show menu and other information.
701  *
702  * Returns     :  JB_ERR_OK on success
703  *                JB_ERR_MEMORY on out-of-memory error.  
704  *
705  *********************************************************************/
706 jb_err cgi_show_status(struct client_state *csp,
707                        struct http_response *rsp,
708                        const struct map *parameters)
709 {
710    char *s = NULL;
711    unsigned i;
712    int j;
713
714    FILE * fp;
715    char buf[BUFFER_SIZE];
716    const char * filename = NULL;
717    char * file_description = NULL;
718 #ifdef FEATURE_STATISTICS
719    float perc_rej;   /* Percentage of http requests rejected */
720    int local_urls_read;
721    int local_urls_rejected;
722 #endif /* ndef FEATURE_STATISTICS */
723    struct file_list * fl;
724    struct url_actions * b;
725    jb_err err = JB_ERR_OK;
726
727    struct map *exports;
728
729    assert(csp);
730    assert(rsp);
731    assert(parameters);
732
733    if (NULL == (exports = default_exports(csp, "show-status")))
734    {
735       return JB_ERR_MEMORY;
736    }
737
738    switch (*(lookup(parameters, "file")))
739    {
740    case 'a':
741       if (!get_number_param(csp, parameters, "index", &i) && i < MAX_ACTION_FILES && csp->actions_list[i])
742       {
743          filename = csp->actions_list[i]->filename;
744          file_description = "Actions File";
745       }
746       break;
747
748    case 'f':
749       if (csp->rlist)
750       {
751          filename = csp->rlist->filename;
752          file_description = "Filter File";
753       }
754       break;
755
756 #ifdef FEATURE_TRUST
757    case 't':
758       if (csp->tlist)
759       {
760          filename = csp->tlist->filename;
761          file_description = "Trust File";
762       }
763       break;
764 #endif /* def FEATURE_TRUST */
765    }
766
767    if (NULL != filename)
768    {
769       if ( map(exports, "file-description", 1, file_description, 1)
770         || map(exports, "filepath", 1, html_encode(filename), 0) )
771       {
772          free_map(exports);
773          return JB_ERR_MEMORY;
774       }
775
776       if ((fp = fopen(filename, "r")) == NULL)
777       {
778          if (map(exports, "content", 1, "<h1>ERROR OPENING FILE!</h1>", 1))
779          {
780             free_map(exports);
781             return JB_ERR_MEMORY;
782          }
783       }
784       else
785       {
786          s = strdup("");
787          while ((s != NULL) && fgets(buf, sizeof(buf), fp))
788          {
789             string_join  (&s, html_encode(buf));
790          }
791          fclose(fp);
792
793          if (map(exports, "contents", 1, s, 0))
794          {
795             free_map(exports);
796             return JB_ERR_MEMORY;
797          }
798       }
799
800       return template_fill_for_cgi(csp, "show-status-file", exports, rsp);
801    }
802
803    s = strdup("");
804    for (j = 0; (s != NULL) && (j < Argc); j++)
805    {
806       if (!err) err = string_join  (&s, html_encode(Argv[j]));
807       if (!err) err = string_append(&s, " ");
808    }
809    if (!err) err = map(exports, "invocation", 1, s, 0);
810
811    if (!err) err = map(exports, "options", 1, csp->config->proxy_args, 1);
812    if (!err) err = show_defines(exports);
813
814    if (err) 
815    {
816       free_map(exports);
817       return JB_ERR_MEMORY;
818    }
819
820 #ifdef FEATURE_STATISTICS
821    local_urls_read     = urls_read;
822    local_urls_rejected = urls_rejected;
823
824    /*
825     * Need to alter the stats not to include the fetch of this
826     * page.
827     *
828     * Can't do following thread safely! doh!
829     *
830     * urls_read--;
831     * urls_rejected--; * This will be incremented subsequently *
832     */
833
834    if (local_urls_read == 0)
835    {
836       if (!err) err = map_block_killer(exports, "have-stats");
837    }
838    else
839    {
840       if (!err) err = map_block_killer(exports, "have-no-stats");
841
842       perc_rej = (float)local_urls_rejected * 100.0F /
843             (float)local_urls_read;
844
845       sprintf(buf, "%d", local_urls_read);
846       if (!err) err = map(exports, "requests-received", 1, buf, 1);
847
848       sprintf(buf, "%d", local_urls_rejected);
849       if (!err) err = map(exports, "requests-blocked", 1, buf, 1);
850
851       sprintf(buf, "%6.2f", perc_rej);
852       if (!err) err = map(exports, "percent-blocked", 1, buf, 1);
853    }
854
855 #else /* ndef FEATURE_STATISTICS */
856    err = err || map_block_killer(exports, "statistics");
857 #endif /* ndef FEATURE_STATISTICS */
858    
859    /* 
860     * List all action files in use, together with view and edit links,
861     * except for standard.action, which should only be viewable. (Not
862     * enforced in the editor itself)
863     * FIXME: Shouldn't include hardwired HTML here, use line template instead!
864     */
865    s = strdup("");
866    for (i = 0; i < MAX_ACTION_FILES; i++)
867    {
868       if (((fl = csp->actions_list[i]) != NULL) && ((b = fl->f) != NULL))
869       {
870          if (!err) err = string_append(&s, "<tr><td>");
871          if (!err) err = string_join(&s, html_encode(csp->actions_list[i]->filename));
872          snprintf(buf, 100, "</td><td class=\"buttons\"><a href=\"/show-status?file=actions&index=%d\">View</a> ", i);
873          if (!err) err = string_append(&s, buf);
874
875          if (NULL == strstr(csp->actions_list[i]->filename, "standard.action") && NULL != csp->config->actions_file_short[i])
876          {
877             snprintf(buf, 100, "<a href=\"/edit-actions-list?f=%s\">Edit</a>", csp->config->actions_file_short[i]);
878             if (!err) err = string_append(&s, buf);
879          }
880
881          if (!err) err = string_append(&s, "</td></tr>\n");
882       }
883    }
884    if (*s != '\0')   
885    {
886       if (!err) err = map(exports, "actions-filenames", 1, s, 0);
887    }
888    else
889    {
890       if (!err) err = map(exports, "actions-filenames", 1, "<tr><td>None specified</td></tr>", 1);
891    }
892
893    if (csp->rlist)
894    {
895       if (!err) err = map(exports, "re-filter-filename", 1, html_encode(csp->rlist->filename), 0);
896    }
897    else
898    {
899       if (!err) err = map(exports, "re-filter-filename", 1, "None specified", 1);
900       if (!err) err = map_block_killer(exports, "have-filterfile");
901    }
902
903 #ifdef FEATURE_TRUST
904    if (csp->tlist)
905    {
906       if (!err) err = map(exports, "trust-filename", 1, html_encode(csp->tlist->filename), 0);
907    }
908    else
909    {
910       if (!err) err = map(exports, "trust-filename", 1, "None specified", 1);
911       if (!err) err = map_block_killer(exports, "have-trustfile");
912    }
913 #else
914    if (!err) err = map_block_killer(exports, "trust-support");
915 #endif /* ndef FEATURE_TRUST */
916
917    if (err)
918    {
919       free_map(exports);
920       return JB_ERR_MEMORY;
921    }
922
923    return template_fill_for_cgi(csp, "show-status", exports, rsp);
924 }
925
926  
927 /*********************************************************************
928  *
929  * Function    :  cgi_show_url_info
930  *
931  * Description :  CGI function that determines and shows which actions
932  *                Privoxy will perform for a given url, and which
933  *                matches starting from the defaults have lead to that.
934  *
935  * Parameters  :
936  *          1  :  csp = Current client state (buffers, headers, etc...)
937  *          2  :  rsp = http_response data structure for output
938  *          3  :  parameters = map of cgi parameters
939  *
940  * CGI Parameters :
941  *            url : The url whose actions are to be determined.
942  *                  If url is unset, the url-given conditional will be
943  *                  set, so that all but the form can be suppressed in
944  *                  the template.
945  *
946  * Returns     :  JB_ERR_OK on success
947  *                JB_ERR_MEMORY on out-of-memory error.  
948  *
949  *********************************************************************/
950 jb_err cgi_show_url_info(struct client_state *csp,
951                          struct http_response *rsp,
952                          const struct map *parameters)
953 {
954    char *url_param;
955    struct map *exports;
956    char buf[150];
957
958    assert(csp);
959    assert(rsp);
960    assert(parameters);
961
962    if (NULL == (exports = default_exports(csp, "show-url-info")))
963    {
964       return JB_ERR_MEMORY;
965    }
966
967    /*
968     * Get the url= parameter (if present) and remove any leading/trailing spaces.
969     */
970    url_param = strdup(lookup(parameters, "url"));
971    if (url_param == NULL)
972    {
973       free_map(exports);
974       return JB_ERR_MEMORY;
975    }
976    chomp(url_param);
977
978    /*
979     * Handle prefixes.  4 possibilities:
980     * 1) "http://" or "https://" prefix present and followed by URL - OK
981     * 2) Only the "http://" or "https://" part is present, no URL - change
982     *    to empty string so it will be detected later as "no URL".
983     * 3) Parameter specified but doesn't contain "http(s?)://" - add a
984     *    "http://" prefix.
985     * 4) Parameter not specified or is empty string - let this fall through
986     *    for now, next block of code will handle it.
987     */
988    if (0 == strncmp(url_param, "http://", 7))
989    {
990       if (url_param[7] == '\0')
991       {
992          /*
993           * Empty URL (just prefix).
994           * Make it totally empty so it's caught by the next if()
995           */
996          url_param[0] = '\0';
997       }
998    }
999    else if (0 == strncmp(url_param, "https://", 8))
1000    {
1001       if (url_param[8] == '\0')
1002       {
1003          /*
1004           * Empty URL (just prefix).
1005           * Make it totally empty so it's caught by the next if()
1006           */
1007          url_param[0] = '\0';
1008       }
1009    }
1010    else if (url_param[0] != '\0')
1011    {
1012       /*
1013        * Unknown prefix - assume http://
1014        */
1015       char * url_param_prefixed = malloc(7 + 1 + strlen(url_param));
1016       if (NULL == url_param_prefixed)
1017       {
1018          free(url_param);
1019          free_map(exports);
1020          return JB_ERR_MEMORY;
1021       }
1022       strcpy(url_param_prefixed, "http://");
1023       strcpy(url_param_prefixed + 7, url_param);
1024       free(url_param);
1025       url_param = url_param_prefixed;
1026    }
1027
1028
1029    if (url_param[0] == '\0')
1030    {
1031       /* URL paramater not specified, display query form only. */
1032       free(url_param);
1033       if (map_block_killer(exports, "url-given")
1034         || map(exports, "url", 1, "", 1))
1035       {
1036          free_map(exports);
1037          return JB_ERR_MEMORY;
1038       }
1039    }
1040    else
1041    {
1042       /* Given a URL, so query it. */
1043       jb_err err;
1044       char *matches;
1045       char *s;
1046       int hits = 0;
1047       struct file_list *fl;
1048       struct url_actions *b;
1049       struct http_request url_to_query[1];
1050       struct current_action_spec action[1];
1051       int i;
1052       
1053       if (map(exports, "url", 1, html_encode(url_param), 0))
1054       {
1055          free(url_param);
1056          free_map(exports);
1057          return JB_ERR_MEMORY;
1058       }
1059
1060       init_current_action(action);
1061
1062       if (map(exports, "default", 1, current_action_to_html(csp, action), 0))
1063       {
1064          free_current_action(action);
1065          free(url_param);
1066          free_map(exports);
1067          return JB_ERR_MEMORY;
1068       }
1069
1070       err = parse_http_url(url_param, url_to_query, csp);
1071
1072       free(url_param);
1073
1074       if (err == JB_ERR_MEMORY)
1075       {
1076          free_current_action(action);
1077          free_map(exports);
1078          return JB_ERR_MEMORY;
1079       }
1080       else if (err)
1081       {
1082          /* Invalid URL */
1083
1084          err = map(exports, "matches", 1, "<b>[Invalid URL specified!]</b>" , 1);
1085          if (!err) err = map(exports, "final", 1, lookup(exports, "default"), 1);
1086
1087          free_current_action(action);
1088
1089          if (err)
1090          {
1091             free_map(exports);
1092             return JB_ERR_MEMORY;
1093          }
1094
1095          return template_fill_for_cgi(csp, "show-url-info", exports, rsp);
1096       }
1097
1098       /*
1099        * We have a warning about SSL paths.  Hide it for insecure sites.
1100        */
1101       if (!url_to_query->ssl)
1102       {
1103          if (map_block_killer(exports, "https"))
1104          {
1105             free_current_action(action);
1106             free_map(exports);
1107             return JB_ERR_MEMORY;
1108          }
1109       }
1110
1111       matches = strdup("<table class=\"transparent\">");
1112
1113       for (i = 0; i < MAX_ACTION_FILES; i++)
1114       {
1115          if (NULL == csp->config->actions_file_short[i]
1116              || !strcmp(csp->config->actions_file_short[i], "standard")) continue;
1117
1118          b = NULL;
1119          hits = 1;
1120          if ((fl = csp->actions_list[i]) != NULL)
1121          {
1122             if ((b = fl->f) != NULL)
1123             {
1124                /* FIXME: Hardcoded HTML! */
1125                string_append(&matches, "<tr><th>In file: ");
1126                string_join  (&matches, html_encode(csp->config->actions_file_short[i]));
1127                snprintf(buf, 150, ".action <a class=\"cmd\" href=\"/show-status?file=actions&index=%d\">", i);
1128                string_append(&matches, buf);
1129                string_append(&matches, "View</a> <a class=\"cmd\" href=\"/edit-actions-list?f=");
1130                string_join  (&matches, html_encode(csp->config->actions_file_short[i]));
1131                string_append(&matches, "\">Edit</a></th></tr>\n");
1132
1133                hits = 0;
1134                b = b->next;
1135             }
1136          }
1137
1138          for (; (b != NULL) && (matches != NULL); b = b->next)
1139          {
1140             if (url_match(b->url, url_to_query))
1141             {
1142                string_append(&matches, "<tr><td>{");
1143                string_join  (&matches, actions_to_html(csp, b->action));
1144                string_append(&matches, " }</b><br>\n<code>");
1145                string_join  (&matches, html_encode(b->url->spec));
1146                string_append(&matches, "</code></td></tr>\n");
1147
1148                if (merge_current_action(action, b->action))
1149                {
1150                   freez(matches);
1151                   free_http_request(url_to_query);
1152                   free_current_action(action);
1153                   free_map(exports);
1154                   return JB_ERR_MEMORY;
1155                }
1156                hits++;
1157             }
1158          }
1159
1160          if (!hits)
1161          {
1162             string_append(&matches, "<tr><td>(no matches in this file)</td></tr>\n");
1163          }
1164       }
1165       string_append(&matches, "</table>\n");
1166
1167       free_http_request(url_to_query);
1168
1169       if (matches == NULL)
1170       {
1171          free_current_action(action);
1172          free_map(exports);
1173          return JB_ERR_MEMORY;
1174       }
1175
1176       if (map(exports, "matches", 1, matches , 0))
1177       {
1178          free_current_action(action);
1179          free_map(exports);
1180          return JB_ERR_MEMORY;
1181       }
1182
1183       s = current_action_to_html(csp, action);
1184
1185       free_current_action(action);
1186
1187       if (map(exports, "final", 1, s, 0))
1188       {
1189          free_map(exports);
1190          return JB_ERR_MEMORY;
1191       }
1192    }
1193
1194    return template_fill_for_cgi(csp, "show-url-info", exports, rsp);
1195 }
1196
1197
1198 /*********************************************************************
1199  *
1200  * Function    :  cgi_robots_txt
1201  *
1202  * Description :  CGI function to return "/robots.txt".
1203  *
1204  * Parameters  :
1205  *          1  :  csp = Current client state (buffers, headers, etc...)
1206  *          2  :  rsp = http_response data structure for output
1207  *          3  :  parameters = map of cgi parameters
1208  *
1209  * CGI Parameters : None
1210  *
1211  * Returns     :  JB_ERR_OK on success
1212  *                JB_ERR_MEMORY on out-of-memory error.  
1213  *
1214  *********************************************************************/
1215 jb_err cgi_robots_txt(struct client_state *csp,
1216                       struct http_response *rsp,
1217                       const struct map *parameters)
1218 {
1219    char buf[100];
1220    jb_err err;
1221
1222    rsp->body = strdup(
1223       "# This is the Privoxy control interface.\n"
1224       "# It isn't very useful to index it, and you're likely to break stuff.\n"
1225       "# So go away!\n"
1226       "\n"
1227       "User-agent: *\n"
1228       "Disallow: /\n"
1229       "\n");
1230    if (rsp->body == NULL)
1231    {
1232       return JB_ERR_MEMORY;
1233    }
1234
1235    err = enlist_unique(rsp->headers, "Content-Type: text/plain", 13);
1236
1237    rsp->is_static = 1;
1238
1239    get_http_time(7 * 24 * 60 * 60, buf); /* 7 days into future */
1240    if (!err) err = enlist_unique_header(rsp->headers, "Expires", buf);
1241
1242    return (err ? JB_ERR_MEMORY : JB_ERR_OK);
1243 }
1244
1245
1246 /*********************************************************************
1247  *
1248  * Function    :  show_defines
1249  *
1250  * Description :  Add to a map the state od all conditional #defines
1251  *                used when building
1252  *
1253  * Parameters  :
1254  *          1  :  exports = map to extend
1255  *
1256  * Returns     :  JB_ERR_OK on success
1257  *                JB_ERR_MEMORY on out-of-memory error.  
1258  *
1259  *********************************************************************/
1260 static jb_err show_defines(struct map *exports)
1261 {
1262    jb_err err = JB_ERR_OK;
1263
1264 #ifdef FEATURE_ACL
1265    if (!err) err = map_conditional(exports, "FEATURE_ACL", 1);
1266 #else /* ifndef FEATURE_ACL */
1267    if (!err) err = map_conditional(exports, "FEATURE_ACL", 0);
1268 #endif /* ndef FEATURE_ACL */
1269
1270 #ifdef FEATURE_CGI_EDIT_ACTIONS
1271    if (!err) err = map_conditional(exports, "FEATURE_CGI_EDIT_ACTIONS", 1);
1272 #else /* ifndef FEATURE_COOKIE_JAR */
1273    if (!err) err = map_conditional(exports, "FEATURE_CGI_EDIT_ACTIONS", 0);
1274 #endif /* ndef FEATURE_COOKIE_JAR */
1275
1276 #ifdef FEATURE_COOKIE_JAR
1277    if (!err) err = map_conditional(exports, "FEATURE_COOKIE_JAR", 1);
1278 #else /* ifndef FEATURE_COOKIE_JAR */
1279    if (!err) err = map_conditional(exports, "FEATURE_COOKIE_JAR", 0);
1280 #endif /* ndef FEATURE_COOKIE_JAR */
1281
1282 #ifdef FEATURE_FAST_REDIRECTS
1283    if (!err) err = map_conditional(exports, "FEATURE_FAST_REDIRECTS", 1);
1284 #else /* ifndef FEATURE_FAST_REDIRECTS */
1285    if (!err) err = map_conditional(exports, "FEATURE_FAST_REDIRECTS", 0);
1286 #endif /* ndef FEATURE_FAST_REDIRECTS */
1287
1288 #ifdef FEATURE_FORCE_LOAD
1289    if (!err) err = map_conditional(exports, "FEATURE_FORCE_LOAD", 1);
1290    if (!err) err = map(exports, "FORCE_PREFIX", 1, FORCE_PREFIX, 1);
1291 #else /* ifndef FEATURE_FORCE_LOAD */
1292    if (!err) err = map_conditional(exports, "FEATURE_FORCE_LOAD", 0);
1293    if (!err) err = map(exports, "FORCE_PREFIX", 1, "(none - disabled)", 1);
1294 #endif /* ndef FEATURE_FORCE_LOAD */
1295
1296 #ifdef FEATURE_IMAGE_BLOCKING
1297    if (!err) err = map_conditional(exports, "FEATURE_IMAGE_BLOCKING", 1);
1298 #else /* ifndef FEATURE_IMAGE_BLOCKING */
1299    if (!err) err = map_conditional(exports, "FEATURE_IMAGE_BLOCKING", 0);
1300 #endif /* ndef FEATURE_IMAGE_BLOCKING */
1301
1302 #ifdef FEATURE_IMAGE_DETECT_MSIE
1303    if (!err) err = map_conditional(exports, "FEATURE_IMAGE_DETECT_MSIE", 1);
1304 #else /* ifndef FEATURE_IMAGE_DETECT_MSIE */
1305    if (!err) err = map_conditional(exports, "FEATURE_IMAGE_DETECT_MSIE", 0);
1306 #endif /* ndef FEATURE_IMAGE_DETECT_MSIE */
1307
1308 #ifdef FEATURE_KILL_POPUPS
1309    if (!err) err = map_conditional(exports, "FEATURE_KILL_POPUPS", 1);
1310 #else /* ifndef FEATURE_KILL_POPUPS */
1311    if (!err) err = map_conditional(exports, "FEATURE_KILL_POPUPS", 0);
1312 #endif /* ndef FEATURE_KILL_POPUPS */
1313
1314 #ifdef FEATURE_NO_GIFS
1315    if (!err) err = map_conditional(exports, "FEATURE_NO_GIFS", 1);
1316 #else /* ifndef FEATURE_NO_GIFS */
1317    if (!err) err = map_conditional(exports, "FEATURE_NO_GIFS", 0);
1318 #endif /* ndef FEATURE_NO_GIFS */
1319
1320 #ifdef FEATURE_PTHREAD
1321    if (!err) err = map_conditional(exports, "FEATURE_PTHREAD", 1);
1322 #else /* ifndef FEATURE_PTHREAD */
1323    if (!err) err = map_conditional(exports, "FEATURE_PTHREAD", 0);
1324 #endif /* ndef FEATURE_PTHREAD */
1325
1326 #ifdef FEATURE_STATISTICS
1327    if (!err) err = map_conditional(exports, "FEATURE_STATISTICS", 1);
1328 #else /* ifndef FEATURE_STATISTICS */
1329    if (!err) err = map_conditional(exports, "FEATURE_STATISTICS", 0);
1330 #endif /* ndef FEATURE_STATISTICS */
1331
1332 #ifdef FEATURE_TOGGLE
1333    if (!err) err = map_conditional(exports, "FEATURE_TOGGLE", 1);
1334 #else /* ifndef FEATURE_TOGGLE */
1335    if (!err) err = map_conditional(exports, "FEATURE_TOGGLE", 0);
1336 #endif /* ndef FEATURE_TOGGLE */
1337
1338 #ifdef FEATURE_TRUST
1339    if (!err) err = map_conditional(exports, "FEATURE_TRUST", 1);
1340 #else /* ifndef FEATURE_TRUST */
1341    if (!err) err = map_conditional(exports, "FEATURE_TRUST", 0);
1342 #endif /* ndef FEATURE_TRUST */
1343
1344 #ifdef STATIC_PCRE
1345    if (!err) err = map_conditional(exports, "STATIC_PCRE", 1);
1346 #else /* ifndef STATIC_PCRE */
1347    if (!err) err = map_conditional(exports, "STATIC_PCRE", 0);
1348 #endif /* ndef STATIC_PCRE */
1349
1350 #ifdef STATIC_PCRS
1351    if (!err) err = map_conditional(exports, "STATIC_PCRS", 1);
1352 #else /* ifndef STATIC_PCRS */
1353    if (!err) err = map_conditional(exports, "STATIC_PCRS", 0);
1354 #endif /* ndef STATIC_PCRS */
1355
1356    return err;
1357 }
1358
1359
1360 /*********************************************************************
1361  *
1362  * Function    :  show_rcs
1363  *
1364  * Description :  Create a string with the rcs info for all sourcefiles
1365  *
1366  * Parameters  :  None
1367  *
1368  * Returns     :  A string, or NULL on out-of-memory.
1369  *
1370  *********************************************************************/
1371 static char *show_rcs(void)
1372 {
1373    char *result = strdup("");
1374    char buf[BUFFER_SIZE];
1375
1376    /* Instead of including *all* dot h's in the project (thus creating a
1377     * tremendous amount of dependencies), I will concede to declaring them
1378     * as extern's.  This forces the developer to add to this list, but oh well.
1379     */
1380
1381 #define SHOW_RCS(__x)              \
1382    {                               \
1383       extern const char __x[];     \
1384       sprintf(buf, "%s\n", __x);   \
1385       string_append(&result, buf); \
1386    }
1387
1388    /* In alphabetical order */
1389    SHOW_RCS(actions_h_rcs)
1390    SHOW_RCS(actions_rcs)
1391 #ifdef AMIGA
1392    SHOW_RCS(amiga_h_rcs)
1393    SHOW_RCS(amiga_rcs)
1394 #endif /* def AMIGA */
1395    SHOW_RCS(cgi_h_rcs)
1396    SHOW_RCS(cgi_rcs)
1397 #ifdef FEATURE_CGI_EDIT_ACTIONS
1398    SHOW_RCS(cgiedit_h_rcs)
1399    SHOW_RCS(cgiedit_rcs)
1400 #endif /* def FEATURE_CGI_EDIT_ACTIONS */
1401    SHOW_RCS(cgisimple_h_rcs)
1402    SHOW_RCS(cgisimple_rcs)
1403 #ifdef __MINGW32__
1404    SHOW_RCS(cygwin_h_rcs)
1405 #endif
1406    SHOW_RCS(deanimate_h_rcs)
1407    SHOW_RCS(deanimate_rcs)
1408    SHOW_RCS(encode_h_rcs)
1409    SHOW_RCS(encode_rcs)
1410    SHOW_RCS(errlog_h_rcs)
1411    SHOW_RCS(errlog_rcs)
1412    SHOW_RCS(filters_h_rcs)
1413    SHOW_RCS(filters_rcs)
1414    SHOW_RCS(gateway_h_rcs)
1415    SHOW_RCS(gateway_rcs)
1416 #ifdef FEATURE_ACTIVITY_CONSOLE
1417    SHOW_RCS(ipc_h_rcs)
1418 #endif /* def FEATURE_ACTIVITY_CONSOLE */
1419    SHOW_RCS(jbsockets_h_rcs)
1420    SHOW_RCS(jbsockets_rcs)
1421    SHOW_RCS(jcc_h_rcs)
1422    SHOW_RCS(jcc_rcs)
1423 #ifdef FEATURE_KILL_POPUPS
1424    SHOW_RCS(killpopup_h_rcs)
1425    SHOW_RCS(killpopup_rcs)
1426 #endif /* def FEATURE_KILL_POPUPS */
1427    SHOW_RCS(list_h_rcs)
1428    SHOW_RCS(list_rcs)
1429    SHOW_RCS(loadcfg_h_rcs)
1430    SHOW_RCS(loadcfg_rcs)
1431    SHOW_RCS(loaders_h_rcs)
1432    SHOW_RCS(loaders_rcs)
1433    SHOW_RCS(miscutil_h_rcs)
1434    SHOW_RCS(miscutil_rcs)
1435    SHOW_RCS(parsers_h_rcs)
1436    SHOW_RCS(parsers_rcs)
1437    SHOW_RCS(pcrs_rcs)
1438    SHOW_RCS(pcrs_h_rcs)
1439    SHOW_RCS(project_h_rcs)
1440    SHOW_RCS(ssplit_h_rcs)
1441    SHOW_RCS(ssplit_rcs)
1442 #ifdef FEATURE_ACTIVITY_CONSOLE
1443    SHOW_RCS(stats_h_rcs)
1444    SHOW_RCS(stats_rcs)
1445 #endif /* def FEATURE_ACTIVITY_CONSOLE */
1446    SHOW_RCS(urlmatch_h_rcs)
1447    SHOW_RCS(urlmatch_rcs)
1448 #ifdef _WIN32
1449 #ifndef _WIN_CONSOLE
1450    SHOW_RCS(w32log_h_rcs)
1451    SHOW_RCS(w32log_rcs)
1452    SHOW_RCS(w32res_h_rcs)
1453    SHOW_RCS(w32taskbar_h_rcs)
1454    SHOW_RCS(w32taskbar_rcs)
1455 #endif /* ndef _WIN_CONSOLE */
1456    SHOW_RCS(win32_h_rcs)
1457    SHOW_RCS(win32_rcs)
1458 #endif /* def _WIN32 */
1459
1460 #undef SHOW_RCS
1461
1462    return result;
1463
1464 }
1465
1466
1467 /*
1468   Local Variables:
1469   tab-width: 3
1470   end:
1471 */