diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2010-06-06 00:21:02 +0100 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2010-06-06 00:21:02 +0100 |
commit | b308cf9bafbdf76da73a57607b65c4763aa3057b (patch) | |
tree | c686906b479a0edd52b18a213e1d420f7343855d /unix.c | |
parent | 3ab1d317831a6c1830bb648a1a8d63a41c92f651 (diff) | |
parent | e774815bc621af90bb64ca314b84367659c5a005 (diff) |
Merging libpurple branch into killerbee. It's fairly usable already, and
Debian packaging is now properly separated. This also picks up a load of
stuff from mainline it seems.
Diffstat (limited to 'unix.c')
-rw-r--r-- | unix.c | 34 |
1 files changed, 19 insertions, 15 deletions
@@ -55,16 +55,26 @@ int main( int argc, char *argv[] ) return crypt_main( argc, argv ); log_init(); + global.conf_file = g_strdup( CONF_FILE_DEF ); global.conf = conf_load( argc, argv ); if( global.conf == NULL ) return( 1 ); b_main_init(); - nogaim_init(); srand( time( NULL ) ^ getpid() ); + global.helpfile = g_strdup( HELP_FILE ); + if( help_init( &global.help, global.helpfile ) == NULL ) + log_message( LOGLVL_WARNING, "Error opening helpfile %s.", HELP_FILE ); + + global.storage = storage_init( global.conf->primary_storage, global.conf->migrate_storage ); + if( global.storage == NULL ) + { + log_message( LOGLVL_ERROR, "Unable to load storage backend '%s'", global.conf->primary_storage ); + return( 1 ); + } if( global.conf->runmode == RUNMODE_INETD ) { @@ -72,19 +82,22 @@ int main( int argc, char *argv[] ) log_link( LOGLVL_WARNING, LOGOUTPUT_IRC ); i = bitlbee_inetd_init(); - log_message( LOGLVL_INFO, "Bitlbee %s starting in inetd mode.", BITLBEE_VERSION ); + log_message( LOGLVL_INFO, "BitlBee %s starting in inetd mode.", BITLBEE_VERSION ); } else if( global.conf->runmode == RUNMODE_DAEMON ) { - log_link( LOGLVL_ERROR, LOGOUTPUT_SYSLOG ); - log_link( LOGLVL_WARNING, LOGOUTPUT_SYSLOG ); + log_link( LOGLVL_ERROR, LOGOUTPUT_CONSOLE ); + log_link( LOGLVL_WARNING, LOGOUTPUT_CONSOLE ); i = bitlbee_daemon_init(); - log_message( LOGLVL_INFO, "Bitlbee %s starting in daemon mode.", BITLBEE_VERSION ); + log_message( LOGLVL_INFO, "BitlBee %s starting in daemon mode.", BITLBEE_VERSION ); } else if( global.conf->runmode == RUNMODE_FORKDAEMON ) { + log_link( LOGLVL_ERROR, LOGOUTPUT_CONSOLE ); + log_link( LOGLVL_WARNING, LOGOUTPUT_CONSOLE ); + /* In case the operator requests a restart, we need this. */ old_cwd = g_malloc( 256 ); if( getcwd( old_cwd, 255 ) == NULL ) @@ -95,7 +108,7 @@ int main( int argc, char *argv[] ) } i = bitlbee_daemon_init(); - log_message( LOGLVL_INFO, "Bitlbee %s starting in forking daemon mode.", BITLBEE_VERSION ); + log_message( LOGLVL_INFO, "BitlBee %s starting in forking daemon mode.", BITLBEE_VERSION ); } if( i != 0 ) return( i ); @@ -113,13 +126,6 @@ int main( int argc, char *argv[] ) setuid( pw->pw_uid ); } } - - global.storage = storage_init( global.conf->primary_storage, global.conf->migrate_storage ); - if( global.storage == NULL ) - { - log_message( LOGLVL_ERROR, "Unable to load storage backend '%s'", global.conf->primary_storage ); - return( 1 ); - } /* Catch some signals to tell the user what's happening before quitting */ memset( &sig, 0, sizeof( sig ) ); @@ -138,8 +144,6 @@ int main( int argc, char *argv[] ) if( !getuid() || !geteuid() ) log_message( LOGLVL_WARNING, "BitlBee is running with root privileges. Why?" ); - if( help_init( &global.help, global.helpfile ) == NULL ) - log_message( LOGLVL_WARNING, "Error opening helpfile %s.", HELP_FILE ); b_main_run(); |