Conditional administrator e-mail address... some templates need colspan=2
[privoxy.git] / loadcfg.c
index 18db099..cf6dabc 100644 (file)
--- a/loadcfg.c
+++ b/loadcfg.c
@@ -1,4 +1,4 @@
-const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.19 2001/07/15 17:45:16 jongfoster Exp $";
+const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.22 2001/09/22 16:36:59 jongfoster Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/loadcfg.c,v $
@@ -35,6 +35,19 @@ const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.19 2001/07/15 17:45:16 jongfoster
  *
  * Revisions   :
  *    $Log: loadcfg.c,v $
+ *    Revision 1.22  2001/09/22 16:36:59  jongfoster
+ *    Removing unused parameter fs from read_config_line()
+ *
+ *    Revision 1.21  2001/09/16 17:10:43  jongfoster
+ *    Moving function savearg() here, since it was the only thing left in
+ *    showargs.c.
+ *
+ *    Revision 1.20  2001/07/30 22:08:36  jongfoster
+ *    Tidying up #defines:
+ *    - All feature #defines are now of the form FEATURE_xxx
+ *    - Permanently turned off WIN_GUI_EDIT
+ *    - Permanently turned on WEBDAV and SPLIT_PROXY_ARGS
+ *
  *    Revision 1.19  2001/07/15 17:45:16  jongfoster
  *    Removing some unused #includes
  *
@@ -226,14 +239,10 @@ const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.19 2001/07/15 17:45:16 jongfoster
 #include "jcc.h"
 #include "filters.h"
 #include "loaders.h"
-#include "showargs.h"
-#include "parsers.h"
-#include "killpopup.h"
 #include "miscutil.h"
 #include "errlog.h"
-#include "jbsockets.h"
-#include "gateway.h"
 #include "ssplit.h"
+#include "encode.h"
 
 const char loadcfg_h_rcs[] = LOADCFG_H_VERSION;
 
@@ -280,6 +289,7 @@ static struct file_list *current_configfile = NULL;
 
 #define hash_actions_file              1196306641ul /* "actionsfile" */
 #define hash_admin_address             4112573064ul /* "admin-address" */
+#define hash_buffer_limit              1881726070ul /* "buffer-limit */
 #define hash_confdir                      1978389ul /* "confdir" */
 #define hash_debug                          78263ul /* "debug" */
 #define hash_deny_access               1227333715ul /* "deny-access" */
@@ -311,6 +321,8 @@ static struct file_list *current_configfile = NULL;
 #define hash_show_on_task_bar           215410365ul /* "show-on-task-bar" */
 
 
+static void savearg(char *c, char *o, struct configuration_spec * config);
+
 
 /*********************************************************************
  *
@@ -446,6 +458,7 @@ struct configuration_spec * load_config(void)
 
    config->multi_threaded    = 1;
    config->hport             = HADDR_PORT;
+   config->buffer_limit      = 4096 * 1024;
 
    if ((configfp = fopen(configfile, "r")) == NULL)
    {
@@ -454,7 +467,7 @@ struct configuration_spec * load_config(void)
       /* Never get here - LOG_LEVEL_FATAL causes program exit */
    }
 
-   while (read_config_line(buf, sizeof(buf), configfp, fs) != NULL)
+   while (read_config_line(buf, sizeof(buf), configfp) != NULL)
    {
       char cmd[BUFFER_SIZE];
       char arg[BUFFER_SIZE];
@@ -524,6 +537,13 @@ struct configuration_spec * load_config(void)
             config->admin_address = strdup(arg);
             continue;       
 
+/****************************************************************************
+ * buffer-limit n
+ ****************************************************************************/
+         case hash_buffer_limit :
+            config->buffer_limit = (size_t) 1024 * atoi(arg);
+            continue;       
+
 /****************************************************************************
  * confdir directory-name
  ****************************************************************************/
@@ -1284,6 +1304,62 @@ struct configuration_spec * load_config(void)
 }
 
 
+/*********************************************************************
+ *
+ * Function    :  savearg
+ *
+ * Description :  Called from `load_config'.  It saves each non-empty
+ *                and non-comment line from config into a list.  This
+ *                list is used to create the show-proxy-args page.
+ *
+ * Parameters  :
+ *          1  :  c = config setting that was found
+ *          2  :  o = the setting's argument (if any)
+ *
+ * Returns     :  N/A
+ *
+ *********************************************************************/
+static void savearg(char *c, char *o, struct configuration_spec * config)
+{
+   char buf[BUFFER_SIZE];
+
+   *buf = '\0';
+
+   if ( ( NULL != c ) && ( '\0' != *c ) )
+   {
+      if ((c = html_encode(c)))
+      {
+         sprintf(buf, "<a href=\"" REDIRECT_URL "option#%s\">%s</a> ", c, c);
+      }
+      freez(c);
+   }
+   if ( ( NULL != o ) && ( '\0' != *o ) )
+   {
+      if ((o = html_encode(o)))
+      {
+         if (strncmpic(o, "http://", 7) == 0)
+         {
+            strcat(buf, "<a href=\"");
+            strcat(buf, o);
+            strcat(buf, "\">");
+            strcat(buf, o);
+            strcat(buf, "</a>");
+         }
+         else
+         {
+            strcat(buf, o);
+         }
+      }
+      freez(o);
+   }
+
+   strcat(buf, "<br>\n");
+
+   config->proxy_args = strsav(config->proxy_args, buf);
+
+}
+
+
 /*
   Local Variables:
   tab-width: 3