Changes in conf.c [2a6ca4f:7cf85e7]
Legend:
- Unmodified
- Added
- Removed
-
conf.c
r2a6ca4f r7cf85e7 32 32 #include "ini.h" 33 33 #include "url.h" 34 #include "ipc.h" 34 35 35 36 #include "protocols/proxy.h" … … 61 62 conf->configdir = g_strdup( CONFIG ); 62 63 conf->plugindir = g_strdup( PLUGINDIR ); 64 conf->pidfile = g_strdup( "/var/run/bitlbee.pid" ); 63 65 conf->motdfile = g_strdup( ETCDIR "/motd.txt" ); 64 66 conf->ping_interval = 180; 65 67 conf->ping_timeout = 300; 68 proxytype = 0; 66 69 67 70 i = conf_loadini( conf, CONF_FILE ); … … 76 79 } 77 80 78 while( ( opt = getopt( argc, argv, "i:p:nvIDFc: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. */ 79 83 { 80 84 if( opt == 'i' ) … … 91 95 conf->port = i; 92 96 } 97 else if( opt == 'p' ) 98 { 99 g_free( conf->pidfile ); 100 conf->pidfile = g_strdup( optarg ); 101 } 93 102 else if( opt == 'n' ) 94 conf->nofork =1;103 conf->nofork = 1; 95 104 else if( opt == 'v' ) 96 conf->verbose =1;105 conf->verbose = 1; 97 106 else if( opt == 'I' ) 98 conf->runmode =RUNMODE_INETD;107 conf->runmode = RUNMODE_INETD; 99 108 else if( opt == 'D' ) 100 conf->runmode =RUNMODE_DAEMON;109 conf->runmode = RUNMODE_DAEMON; 101 110 else if( opt == 'F' ) 102 conf->runmode =RUNMODE_FORKDAEMON;111 conf->runmode = RUNMODE_FORKDAEMON; 103 112 else if( opt == 'c' ) 104 113 { … … 108 117 CONF_FILE = g_strdup( optarg ); 109 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; 110 123 return( conf_load( argc, argv ) ); 111 124 } … … 126 139 " -D Daemon mode. (Still EXPERIMENTAL!)\n" 127 140 " -F Forking daemon. (one process per client)\n" 141 " -P Specify PID-file (not for inetd mode)\n" 128 142 " -i Specify the interface (by IP address) to listen on.\n" 129 143 " (Default: 0.0.0.0 (any interface))\n" … … 136 150 return( NULL ); 137 151 } 152 else if( opt == 'R' ) 153 { 154 /* We can't load the statefile yet (and should make very sure we do this 155 only once), so set the filename here and load the state information 156 when initializing ForkDaemon. (This option only makes sense in that 157 mode anyway!) */ 158 ipc_master_set_statefile( optarg ); 159 } 138 160 } 139 161 … … 169 191 else 170 192 conf->runmode = RUNMODE_INETD; 193 } 194 else if( g_strcasecmp( ini->key, "pidfile" ) == 0 ) 195 { 196 g_free( conf->pidfile ); 197 conf->pidfile = g_strdup( ini->value ); 171 198 } 172 199 else if( g_strcasecmp( ini->key, "daemoninterface" ) == 0 )
Note: See TracChangeset
for help on using the changeset viewer.