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