diff options
author | Kalle Wallin <kaw@linux.se> | 2004-06-06 14:11:06 +0000 |
---|---|---|
committer | Kalle Wallin <kaw@linux.se> | 2004-06-06 14:11:06 +0000 |
commit | ab7b4998b156a959c21b8d277f5ae114f48427c9 (patch) | |
tree | 2a335a2d69f87f781a81d76fe84d08fd962e1095 /src/main.c | |
parent | ddd95cfda00af6e9093b8958af5679cf9b9cc54f (diff) | |
download | mpd-ab7b4998b156a959c21b8d277f5ae114f48427c9.tar.gz mpd-ab7b4998b156a959c21b8d277f5ae114f48427c9.tar.xz mpd-ab7b4998b156a959c21b8d277f5ae114f48427c9.zip |
Moved charset initialization code to main.c, added bind_textdomain_codeset()
git-svn-id: https://svn.musicpd.org/ncmpc/trunk@1350 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r-- | src/main.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/main.c b/src/main.c index 15ecf4532..1a3573e7a 100644 --- a/src/main.c +++ b/src/main.c @@ -1,4 +1,6 @@ /* + * $Id$ + * * (c) 2004 by Kalle Wallin (kaw@linux.se) * * This program is free software; you can redistribute it and/or modify @@ -40,7 +42,6 @@ exit_and_cleanup(void) { screen_exit(); printf("\n"); - charset_close(); if( mpc ) { if( mpc_error(mpc) ) @@ -66,11 +67,24 @@ main(int argc, const char *argv[]) options_t *options; struct sigaction act; gboolean connected; + const char *charset = NULL; + + /* initialize charset */ +#ifdef HAVE_LOCALE_H + if( setlocale(LC_CTYPE,"") == NULL ) + { + g_printerr("setlocale() - failed!\n"); + exit(EXIT_FAILURE); + } + charset_init(g_get_charset(&charset)); + D(printf("charset: %s\n", charset)); +#endif /* initialize i18n support */ #ifdef ENABLE_NLS setlocale(LC_MESSAGES, ""); bindtextdomain(GETTEXT_PACKAGE, LOCALE_DIR); + bind_textdomain_codeset(GETTEXT_PACKAGE, charset); textdomain(GETTEXT_PACKAGE); #endif @@ -93,10 +107,6 @@ main(int argc, const char *argv[]) /* parse command line options - 2 pass */ options_parse(argc, argv); - /* initialize local charset */ - if( charset_init() ) - exit(EXIT_FAILURE); - /* setup signal behavior - SIGINT */ sigemptyset( &act.sa_mask ); act.sa_flags = 0; |