aboutsummaryrefslogtreecommitdiffstats
path: root/unix.c
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2010-07-24 23:16:18 +0200
committerWilmer van der Gaast <wilmer@gaast.net>2010-07-24 23:16:18 +0200
commit2945c6ff5d1848f6d8e51a0d804a2d769e6894a7 (patch)
tree595788105189dab5270fe2b7dc4e9baffa487aed /unix.c
parentef14a83adbb9036c0006ad460c5e11882a3d7e13 (diff)
parent593971d9ff9f246cec5af5583f29e45fee62edfe (diff)
Merge ui-fix (which includes killerbee (i.e. file transfers and libpurple
support)). ui-fix rewrites the complete IRC core, fixing many things that were broken/hacky/limited so far. The list is too long to include here, but http://wiki.bitlbee.org/UiFix has a summary, as does doc/CHANGES and of course the full revision history.
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();