Merged from silc_1_0_branch (second merge).
[silc.git] / apps / irssi / src / fe-text / silc.c
index 7e296dccac4edc07a8a6372963a250331611beb4..1591e601cf767622f0652bad1d721f43a3909cc8 100644 (file)
@@ -43,6 +43,7 @@
 #include "textbuffer-reformat.h"
 
 #include <signal.h>
+#include <locale.h>
 
 #ifdef HAVE_STATIC_PERL
 void perl_core_init(void);
@@ -147,7 +148,7 @@ static void textui_init(void)
        core_init();
        silc_init();
        fe_common_core_init();
-       fe_common_silc_init();
+       fe_silc_init();
 
        theme_register(gui_text_formats);
        signal_add_last("gui exit", (SIGNAL_FUNC) sig_exit);
@@ -237,7 +238,7 @@ static void textui_deinit(void)
 
        theme_unregister();
 
-       fe_common_silc_deinit();
+       fe_silc_deinit();
        fe_common_core_deinit();
        silc_deinit();
        core_deinit();
@@ -309,7 +310,9 @@ static void winsock_init(void)
 int main(int argc, char **argv)
 {
        static struct poptOption options[] = {
+#if 0 /* --dummy is not available in SILC Client */
                { "dummy", 'd', POPT_ARG_NONE, &dummy, 0, "Use the dummy terminal mode", NULL },
+#endif
                { NULL, '\0', 0, NULL }
        };
 
@@ -331,14 +334,18 @@ int main(int argc, char **argv)
        textdomain(PACKAGE);
 #endif
 
+        /* setlocale() must be called at the beginning before any callsthat
+           affect it, especially regexps seem to break if they'regenerated
+           before t his call.
+
+           locales aren't actually used for anything else thanautodetection
+           of UTF-8 currently.. */
+        setlocale(LC_CTYPE, "");
+
        textui_init();
        args_register(options);
        args_execute(argc, argv);
 
-#if 0
-       silc_init_finish();
-#endif
-
        if (!dummy && !term_init()) {
                fprintf(stderr, "Can't initialize screen handling, quitting.\n");
                fprintf(stderr, "You can still use the dummy mode with -d parameter\n");