X-Git-Url: http://www.privoxy.org/gitweb/?a=blobdiff_plain;f=src%2Floadcfg.c;h=9772ef6bb20bfc48683ee27ee9e0cac791b200ef;hb=206b69b8e4d76197b7594b51d075195e467ee546;hp=30ca4674c75b77b11e89897445bb9f1f7ead6eac;hpb=2da19eb8eff90f6c9a7cb46ff891643e89d50a55;p=privoxy.git diff --git a/src/loadcfg.c b/src/loadcfg.c index 30ca4674..9772ef6b 100644 --- a/src/loadcfg.c +++ b/src/loadcfg.c @@ -1,7 +1,7 @@ -const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.48 2002/05/14 21:30:38 oes Exp $"; +const char loadcfg_rcs[] = "$Id: loadcfg.c,v 2.3 2002/09/19 03:48:29 iwanttokeepanon Exp $"; /********************************************************************* * - * File : $Source: /cvsroot/ijbswa/current/loadcfg.c,v $ + * File : $Source: /cvsroot/ijbswa/current/src/loadcfg.c,v $ * * Purpose : Loads settings from the configuration file into * global variables. This file contains both the @@ -35,6 +35,20 @@ const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.48 2002/05/14 21:30:38 oes Exp $" * * Revisions : * $Log: loadcfg.c,v $ + * Revision 2.3 2002/09/19 03:48:29 iwanttokeepanon + * Just moved "int i" up 3 lines in function unload_configfile, out of the "ifdef FEATURE_ACL" clause. I disable ACL and it was not compiling because "int i" was ifdef(d) out. I noticed this in the past, but am just now in a spot where I can change/commit stuff ... long live broadband! + * + * Revision 2.2 2002/09/04 15:48:33 oes + * Synced with the stable branch: + * Revision 1.48.2.1 2002/08/21 17:58:05 oes + * Temp kludge to let user and default action file be edited through win32 GUI (FR 592080) + * + * Revision 2.1 2002/06/04 17:22:36 jongfoster + * Adding comments + * + * Revision 2.0 2002/06/04 14:34:21 jongfoster + * Moving source files to src/ + * * Revision 1.48 2002/05/14 21:30:38 oes * savearg now uses own linking code instead of (now special-cased) add_help_link * @@ -369,20 +383,32 @@ const char loadcfg_h_rcs[] = LOADCFG_H_VERSION; #define ijb_tolower(__X) tolower((int)(unsigned char)(__X)) #ifdef FEATURE_TOGGLE -/* by haroon - indicates if ijb is enabled */ +/** + * Indicates if Privoxy is currently enabled. + */ int g_bToggleIJB = 1; /* Privoxy is enabled by default. */ #endif /* def FEATURE_TOGGLE */ -/* The filename of the configfile */ +/** + * The filename of the config file + */ const char *configfile = NULL; -/* - * CGI functions will later need access to the invocation args, - * so we will make argc and argv global. +/** + * Global argument count, so that CGI functions can access the + * command line. */ int Argc = 0; + +/** + * Global argument list, so that CGI functions can access the + * command line. + */ const char **Argv = NULL; +/** + * The configuration file which is currently loaded. + */ static struct file_list *current_configfile = NULL; @@ -398,41 +424,43 @@ static struct file_list *current_configfile = NULL; * console and GUI specific options last). */ -#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" */ -#define hash_enable_edit_actions 2517097536ul /* "enable-edit-actions" */ -#define hash_enable_remote_toggle 2979744683ul /* "enable-remote-toggle" */ -#define hash_filterfile 250887266ul /* "filterfile" */ -#define hash_forward 2029845ul /* "forward" */ -#define hash_forward_socks4 3963965521ul /* "forward-socks4" */ -#define hash_forward_socks4a 2639958518ul /* "forward-socks4a" */ -#define hash_jarfile 2046641ul /* "jarfile" */ -#define hash_listen_address 1255650842ul /* "listen-address" */ -#define hash_logdir 422889ul /* "logdir" */ -#define hash_logfile 2114766ul /* "logfile" */ -#define hash_permit_access 3587953268ul /* "permit-access" */ -#define hash_proxy_info_url 3903079059ul /* "proxy-info-url" */ -#define hash_single_threaded 4250084780ul /* "single-threaded" */ -#define hash_suppress_blocklists 1948693308ul /* "suppress-blocklists" */ -#define hash_toggle 447966ul /* "toggle" */ -#define hash_trust_info_url 430331967ul /* "trust-info-url" */ -#define hash_trustfile 56494766ul /* "trustfile" */ -#define hash_usermanual 1416668518ul /* "user-manual" */ -#define hash_activity_animation 1817904738ul /* "activity-animation" */ -#define hash_close_button_minimizes 3651284693ul /* "close-button-minimizes" */ -#define hash_hide_console 2048809870ul /* "hide-console" */ -#define hash_log_buffer_size 2918070425ul /* "log-buffer-size" */ -#define hash_log_font_name 2866730124ul /* "log-font-name" */ -#define hash_log_font_size 2866731014ul /* "log-font-size" */ -#define hash_log_highlight_messages 4032101240ul /* "log-highlight-messages" */ -#define hash_log_max_lines 2868344173ul /* "log-max-lines" */ -#define hash_log_messages 2291744899ul /* "log-messages" */ -#define hash_show_on_task_bar 215410365ul /* "show-on-task-bar" */ - +#define hash_actions_file 1196306641ul /**< "actionsfile" */ +#define hash_activity_console_address 18904208ul /**< "activity-console-address" */ +#define hash_activity_console_update_freq 3442780376ul /**< "activity-console-update-freq" */ +#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" */ +#define hash_enable_edit_actions 2517097536ul /**< "enable-edit-actions" */ +#define hash_enable_remote_toggle 2979744683ul /**< "enable-remote-toggle" */ +#define hash_filterfile 250887266ul /**< "filterfile" */ +#define hash_forward 2029845ul /**< "forward" */ +#define hash_forward_socks4 3963965521ul /**< "forward-socks4" */ +#define hash_forward_socks4a 2639958518ul /**< "forward-socks4a" */ +#define hash_jarfile 2046641ul /**< "jarfile" */ +#define hash_listen_address 1255650842ul /**< "listen-address" */ +#define hash_logdir 422889ul /**< "logdir" */ +#define hash_logfile 2114766ul /**< "logfile" */ +#define hash_permit_access 3587953268ul /**< "permit-access" */ +#define hash_proxy_info_url 3903079059ul /**< "proxy-info-url" */ +#define hash_single_threaded 4250084780ul /**< "single-threaded" */ +#define hash_suppress_blocklists 1948693308ul /**< "suppress-blocklists" */ +#define hash_toggle 447966ul /**< "toggle" */ +#define hash_trust_info_url 430331967ul /**< "trust-info-url" */ +#define hash_trustfile 56494766ul /**< "trustfile" */ +#define hash_usermanual 1416668518ul /**< "user-manual" */ + +#define hash_activity_animation 1817904738ul /**< "activity-animation" */ +#define hash_close_button_minimizes 3651284693ul /**< "close-button-minimizes" */ +#define hash_hide_console 2048809870ul /**< "hide-console" */ +#define hash_log_buffer_size 2918070425ul /**< "log-buffer-size" */ +#define hash_log_font_name 2866730124ul /**< "log-font-name" */ +#define hash_log_font_size 2866731014ul /**< "log-font-size" */ +#define hash_log_highlight_messages 4032101240ul /**< "log-highlight-messages" */ +#define hash_log_max_lines 2868344173ul /**< "log-max-lines" */ +#define hash_log_messages 2291744899ul /**< "log-messages" */ +#define hash_show_on_task_bar 215410365ul /**< "show-on-task-bar" */ static void savearg(char *command, char *argument, struct configuration_spec * config); @@ -452,9 +480,9 @@ void unload_configfile (void * data) { struct configuration_spec * config = (struct configuration_spec *)data; struct forward_spec *cur_fwd = config->forward; + int i; #ifdef FEATURE_ACL struct access_control_list *cur_acl = config->acl; - int i; while (cur_acl != NULL) { @@ -603,6 +631,10 @@ struct configuration_spec * load_config(void) config->buffer_limit = 4096 * 1024; config->usermanual = strdup(USER_MANUAL_URL); config->proxy_args = strdup(""); +#ifdef FEATURE_ACTIVITY_CONSOLE + config->activity_port = ACTIVTY_ADDR_PORT; + config->activity_freq = 5; +#endif /* def FEATURE_ACTIVITY_CONSOLE */ if ((configfp = fopen(configfile, "r")) == NULL) { @@ -693,6 +725,27 @@ struct configuration_spec * load_config(void) free(p); continue; +/* ************************************************************************* + * activity-console-address [ip][:port] + * *************************************************************************/ +#ifdef FEATURE_ACTIVITY_CONSOLE + case hash_activity_console_address : + freez(config->activity_address); + config->activity_address = strdup(arg); + continue; +#endif /* def FEATURE_ACTIVITY_CONSOLE */ + +/* ************************************************************************* + * activity-console-update-freq + * *************************************************************************/ +#ifdef FEATURE_ACTIVITY_CONSOLE + case hash_activity_console_update_freq : + config->activity_freq = atoi(arg); + if (config->activity_freq < 1) + config->activity_freq = 5; + continue; +#endif /* def FEATURE_ACTIVITY_CONSOLE */ + /* ************************************************************************* * admin-address email-address * *************************************************************************/ @@ -1412,6 +1465,36 @@ struct configuration_spec * load_config(void) } #endif /* def FEATURE_COOKIE_JAR */ +#ifdef FEATURE_ACTIVITY_CONSOLE + if ( NULL == config->activity_address ) + { + config->activity_address = strdup( ACTIVTY_ADDR_DEFAULT ); + } + + if ( NULL != config->activity_address ) + { + if (NULL != (p = strchr(config->activity_address, ':'))) + { + *p++ = '\0'; + if (*p) + { + config->activity_port = atoi(p); + } + } + + if (config->activity_port <= 0) + { + *--p = ':'; + log_error(LOG_LEVEL_ERROR, "invalid activity port spec %s", config->activity_address); + } + if (*config->activity_address == '\0') + { + config->activity_address = NULL; + } + } + log_error(LOG_LEVEL_INFO, "Sending statistics updates to %s, port %d.", config->activity_address, config->activity_port); +#endif /* def FEATURE_ACTIVITY_CONSOLE */ + if ( NULL == config->haddr ) { config->haddr = strdup( HADDR_DEFAULT ); @@ -1459,7 +1542,8 @@ struct configuration_spec * load_config(void) /* FIXME: this is a kludge for win32 */ #if defined(_WIN32) && !defined (_WIN_CONSOLE) - g_actions_file = config->actions_file[0]; /* FIXME only works for first action file */ + g_default_actions_file = config->actions_file[1]; /* FIXME Hope this is default.action */ + g_user_actions_file = config->actions_file[2]; /* FIXME Hope this is user.action */ g_re_filterfile = config->re_filterfile; #ifdef FEATURE_TRUST