aboutsummaryrefslogtreecommitdiffstats
path: root/unix.c
diff options
context:
space:
mode:
Diffstat (limited to 'unix.c')
-rw-r--r--unix.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/unix.c b/unix.c
index d58395a1..a9045c44 100644
--- a/unix.c
+++ b/unix.c
@@ -38,6 +38,7 @@
#include <sys/time.h>
#include <sys/wait.h>
#include <pwd.h>
+#include <locale.h>
global_t global; /* Against global namespace pollution */
@@ -51,20 +52,34 @@ int main( int argc, char *argv[] )
char *old_cwd = NULL;
struct sigaction sig, old;
+ /* Required to make iconv to ASCII//TRANSLIT work. This makes BitlBee
+ system-locale-sensitive. :-( */
+ setlocale( LC_CTYPE, "" );
+
if( argc > 1 && strcmp( argv[1], "-x" ) == 0 )
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 )
{
@@ -116,13 +131,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 ) );
@@ -141,8 +149,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();