diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2006-02-02 14:21:44 +0100 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2006-02-02 14:21:44 +0100 |
commit | 34b17d9b8901b72439167b99d780c481ce420e33 (patch) | |
tree | d04b9d40c66b16c170966df19e3f58c7c778e26d /conf.c | |
parent | 8365610bb2013d3478214511910daceabd29ad09 (diff) |
Added PID-file code.
Diffstat (limited to 'conf.c')
-rw-r--r-- | conf.c | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -60,6 +60,7 @@ conf_t *conf_load( int argc, char *argv[] ) conf->oper_pass = NULL; conf->configdir = g_strdup( CONFIG ); conf->plugindir = g_strdup( PLUGINDIR ); + conf->pidfile = g_strdup( "/var/run/bitlbee.pid" ); conf->motdfile = g_strdup( ETCDIR "/motd.txt" ); conf->ping_interval = 180; conf->ping_timeout = 300; @@ -76,7 +77,7 @@ conf_t *conf_load( int argc, char *argv[] ) fprintf( stderr, "Warning: Unable to read configuration file `%s'.\n", CONF_FILE ); } - while( argc > 0 && ( opt = getopt( argc, argv, "i:p:nvIDFc:d:h" ) ) >= 0 ) + while( argc > 0 && ( opt = getopt( argc, argv, "i:p:P:nvIDFc:d:h" ) ) >= 0 ) /* ^^^^ Just to make sure we skip this step from the REHASH handler. */ { if( opt == 'i' ) @@ -92,6 +93,11 @@ conf_t *conf_load( int argc, char *argv[] ) } conf->port = i; } + else if( opt == 'p' ) + { + g_free( conf->pidfile ); + conf->pidfile = g_strdup( optarg ); + } else if( opt == 'n' ) conf->nofork = 1; else if( opt == 'v' ) @@ -175,6 +181,11 @@ static int conf_loadini( conf_t *conf, char *file ) else conf->runmode = RUNMODE_INETD; } + else if( g_strcasecmp( ini->key, "pidfile" ) == 0 ) + { + g_free( conf->pidfile ); + conf->pidfile = g_strdup( ini->value ); + } else if( g_strcasecmp( ini->key, "daemoninterface" ) == 0 ) { conf->iface = g_strdup( ini->value ); |