- Timestamp:
- 2006-02-12T07:26:20Z (18 years ago)
- Branches:
- master
- Children:
- f665dab
- Parents:
- a323a22 (diff), 58bc4e6 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
conf.c
ra323a22 r5ebe625 32 32 #include "ini.h" 33 33 #include "url.h" 34 #include "ipc.h" 34 35 35 36 #include "protocols/proxy.h" … … 46 47 conf = g_new0( conf_t, 1 ); 47 48 49 #ifdef IPV6 50 conf->iface = "::"; 51 #else 48 52 conf->iface = "0.0.0.0"; 53 #endif 49 54 conf->port = 6667; 50 55 conf->nofork = 0; … … 53 58 conf->runmode = RUNMODE_INETD; 54 59 conf->authmode = AUTHMODE_OPEN; 55 conf->password = NULL; 60 conf->auth_pass = NULL; 61 conf->oper_pass = NULL; 56 62 conf->configdir = g_strdup( CONFIG ); 57 63 conf->plugindir = g_strdup( PLUGINDIR ); 64 conf->pidfile = g_strdup( "/var/run/bitlbee.pid" ); 58 65 conf->motdfile = g_strdup( ETCDIR "/motd.txt" ); 59 66 conf->ping_interval = 180; 60 67 conf->ping_timeout = 300; 68 proxytype = 0; 61 69 62 70 i = conf_loadini( conf, CONF_FILE ); … … 71 79 } 72 80 73 while( ( opt = getopt( argc, argv, "i:p:nvIDc:d:h" ) ) >= 0 ) 81 while( argc > 0 && ( opt = getopt( argc, argv, "i:p:P:nvIDFc:d:hR:" ) ) >= 0 ) 82 /* ^^^^ Just to make sure we skip this step from the REHASH handler. */ 74 83 { 75 84 if( opt == 'i' ) … … 86 95 conf->port = i; 87 96 } 97 else if( opt == 'p' ) 98 { 99 g_free( conf->pidfile ); 100 conf->pidfile = g_strdup( optarg ); 101 } 88 102 else if( opt == 'n' ) 89 conf->nofork =1;103 conf->nofork = 1; 90 104 else if( opt == 'v' ) 91 conf->verbose =1;105 conf->verbose = 1; 92 106 else if( opt == 'I' ) 93 conf->runmode =RUNMODE_INETD;107 conf->runmode = RUNMODE_INETD; 94 108 else if( opt == 'D' ) 95 conf->runmode=RUNMODE_DAEMON; 109 conf->runmode = RUNMODE_DAEMON; 110 else if( opt == 'F' ) 111 conf->runmode = RUNMODE_FORKDAEMON; 96 112 else if( opt == 'c' ) 97 113 { … … 101 117 CONF_FILE = g_strdup( optarg ); 102 118 g_free( conf ); 119 /* Re-evaluate arguments. Don't use this option twice, 120 you'll end up in an infinite loop! Hope this trick 121 works with all libcs BTW.. */ 122 optind = 1; 103 123 return( conf_load( argc, argv ) ); 104 124 } … … 118 138 " -I Classic/InetD mode. (Default)\n" 119 139 " -D Daemon mode. (Still EXPERIMENTAL!)\n" 140 " -F Forking daemon. (one process per client)\n" 120 141 " -i Specify the interface (by IP address) to listen on.\n" 121 142 " (Default: 0.0.0.0 (any interface))\n" … … 128 149 return( NULL ); 129 150 } 151 else if( opt == 'R' ) 152 { 153 /* We can't load the statefile yet (and should make very sure we do this 154 only once), so set the filename here and load the state information 155 when initializing ForkDaemon. (This option only makes sense in that 156 mode anyway!) */ 157 ipc_master_set_statefile( optarg ); 158 } 130 159 } 131 160 … … 157 186 if( g_strcasecmp( ini->value, "daemon" ) == 0 ) 158 187 conf->runmode = RUNMODE_DAEMON; 188 else if( g_strcasecmp( ini->value, "forkdaemon" ) == 0 ) 189 conf->runmode = RUNMODE_FORKDAEMON; 159 190 else 160 191 conf->runmode = RUNMODE_INETD; 192 } 193 else if( g_strcasecmp( ini->key, "pidfile" ) == 0 ) 194 { 195 g_free( conf->pidfile ); 196 conf->pidfile = g_strdup( ini->value ); 161 197 } 162 198 else if( g_strcasecmp( ini->key, "daemoninterface" ) == 0 ) … … 184 220 else if( g_strcasecmp( ini->key, "authpassword" ) == 0 ) 185 221 { 186 conf->password = g_strdup( ini->value ); 222 conf->auth_pass = g_strdup( ini->value ); 223 } 224 else if( g_strcasecmp( ini->key, "operpassword" ) == 0 ) 225 { 226 conf->oper_pass = g_strdup( ini->value ); 187 227 } 188 228 else if( g_strcasecmp( ini->key, "hostname" ) == 0 )
Note: See TracChangeset
for help on using the changeset viewer.