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