Changeset eeb85a8
- Timestamp:
- 2008-02-11T12:35:01Z (17 years ago)
- Branches:
- master
- Children:
- 1ba7e8f, 2799ff9
- Parents:
- 3038e47
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
bitlbee.h
r3038e47 reeb85a8 122 122 #define CONF_FILE_DEF ETCDIR "bitlbee.conf" 123 123 124 extern char *CONF_FILE;125 126 124 #include "irc.h" 127 125 #include "storage.h" … … 145 143 gint listen_watch_source_id; 146 144 help_t *help; 145 char *conf_file; 147 146 conf_t *conf; 148 147 GList *storage; /* The first backend in the list will be used for saving */ -
conf.c
r3038e47 reeb85a8 36 36 #include "proxy.h" 37 37 38 char *CONF_FILE;39 40 38 static int conf_loadini( conf_t *conf, char *file ); 41 39 … … 43 41 { 44 42 conf_t *conf; 45 int opt, i ;43 int opt, i, config_missing = 0; 46 44 47 45 conf = g_new0( conf_t, 1 ); … … 66 64 proxytype = 0; 67 65 68 i = conf_loadini( conf, CONF_FILE);66 i = conf_loadini( conf, global.conf_file ); 69 67 if( i == 0 ) 70 68 { 71 fprintf( stderr, "Error: Syntax error in configuration file `%s'.\n", CONF_FILE);72 return ( NULL );69 fprintf( stderr, "Error: Syntax error in configuration file `%s'.\n", global.conf_file ); 70 return NULL; 73 71 } 74 72 else if( i == -1 ) 75 73 { 76 fprintf( stderr, "Warning: Unable to read configuration file `%s'.\n", CONF_FILE ); 74 config_missing ++; 75 /* Whine after parsing the options if there was no -c pointing 76 at a *valid* configuration file. */ 77 77 } 78 78 … … 106 106 else if( opt == 'c' ) 107 107 { 108 if( strcmp( CONF_FILE, optarg ) != 0 )109 { 110 g_free( CONF_FILE);111 CONF_FILE= g_strdup( optarg );108 if( strcmp( global.conf_file, optarg ) != 0 ) 109 { 110 g_free( global.conf_file ); 111 global.conf_file = g_strdup( optarg ); 112 112 g_free( conf ); 113 113 /* Re-evaluate arguments. Don't use this option twice, … … 115 115 works with all libcs BTW.. */ 116 116 optind = 1; 117 return ( conf_load( argc, argv ));117 return conf_load( argc, argv ); 118 118 } 119 119 } … … 143 143 " -d Specify alternative user configuration directory\n" 144 144 " -h Show this help page.\n" ); 145 return ( NULL );145 return NULL; 146 146 } 147 147 else if( opt == 'R' ) … … 169 169 } 170 170 171 return( conf ); 171 if( config_missing ) 172 fprintf( stderr, "Warning: Unable to read configuration file `%s'.\n", global.conf_file ); 173 174 return conf; 172 175 } 173 176 … … 178 181 179 182 ini = ini_open( file ); 180 if( ini == NULL ) return ( -1 );183 if( ini == NULL ) return -1; 181 184 while( ini_read( ini ) ) 182 185 { … … 256 259 { 257 260 fprintf( stderr, "Invalid %s value: %s\n", ini->key, ini->value ); 258 return ( 0 );261 return 0; 259 262 } 260 263 conf->ping_interval = i; … … 265 268 { 266 269 fprintf( stderr, "Invalid %s value: %s\n", ini->key, ini->value ); 267 return ( 0 );270 return 0; 268 271 } 269 272 conf->ping_timeout = i; … … 277 280 fprintf( stderr, "Invalid %s value: %s\n", ini->key, ini->value ); 278 281 g_free( url ); 279 return ( 0 );282 return 0; 280 283 } 281 284 … … 301 304 { 302 305 fprintf( stderr, "Error: Unknown setting `%s` in configuration file.\n", ini->key ); 303 return ( 0 );306 return 0; 304 307 /* For now just ignore unknown keys... */ 305 308 } … … 309 312 fprintf( stderr, "Error: Unknown section [%s] in configuration file. " 310 313 "BitlBee configuration must be put in a [settings] section!\n", ini->section ); 311 return ( 0 );314 return 0; 312 315 } 313 316 } 314 317 ini_close( ini ); 315 318 316 return ( 1 );319 return 1; 317 320 } 318 321 … … 321 324 ini_t *ini; 322 325 323 ini = ini_open( CONF_FILE);326 ini = ini_open( global.conf_file ); 324 327 if( ini == NULL ) return; 325 328 while( ini_read( ini ) ) -
irc_commands.c
r3038e47 reeb85a8 571 571 ipc_to_master( cmd ); 572 572 573 irc_reply( irc, 382, "%s :Rehashing", CONF_FILE);573 irc_reply( irc, 382, "%s :Rehashing", global.conf_file ); 574 574 } 575 575 -
storage_text.c
r3038e47 reeb85a8 30 30 static void text_init (void) 31 31 { 32 if( access( global.conf->configdir, F_OK ) != 0 )33 log_message( LOGLVL_WARNING, "The configuration directory %s does not exist. Configuration won't be saved.", global.conf->configdir );34 else if( access( global.conf->configdir, R_OK ) != 0 || access( global.conf->configdir, W_OK ) != 0 )35 log_message( LOGLVL_WARNING, "Permission problem: Can't read/write from/to %s.", global.conf->configdir );32 /* Don't complain about the configuration directory anymore, leave it 33 up to the XML storage module, which uses the same directory for it 34 anyway. Nobody should be using just the text plugin anymore since 35 it's read only! */ 36 36 } 37 37 -
storage_xml.c
r3038e47 reeb85a8 263 263 { 264 264 if( access( global.conf->configdir, F_OK ) != 0 ) 265 log_message( LOGLVL_WARNING, "The configuration directory %sdoes not exist. Configuration won't be saved.", global.conf->configdir );265 log_message( LOGLVL_WARNING, "The configuration directory `%s' does not exist. Configuration won't be saved.", global.conf->configdir ); 266 266 else if( access( global.conf->configdir, R_OK ) != 0 || access( global.conf->configdir, W_OK ) != 0 ) 267 log_message( LOGLVL_WARNING, "Permission problem: Can't read/write from/to %s.", global.conf->configdir );267 log_message( LOGLVL_WARNING, "Permission problem: Can't read/write from/to `%s'.", global.conf->configdir ); 268 268 } 269 269 -
unix.c
r3038e47 reeb85a8 47 47 48 48 log_init(); 49 CONF_FILE= g_strdup( CONF_FILE_DEF );49 global.conf_file = g_strdup( CONF_FILE_DEF ); 50 50 global.conf = conf_load( argc, argv ); 51 51 if( global.conf == NULL )
Note: See TracChangeset
for help on using the changeset viewer.