speechd-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v3 1/3] Do not exit on localization init fail


From: Boris Dušek
Subject: [PATCH v3 1/3] Do not exit on localization init fail
Date: Sun, 29 Jul 2012 10:42:49 +0200

From: Boris Dus?ek <address@hidden>
To: address@hidden

Localization is not critical to the function of Speech Dispatcher.  So
it should start even if initializing localization fails (better start
unlocalized than not start at all).
---
 include/i18n.h    |    4 ++--
 src/common/i18n.c |   13 +++----------
 2 files changed, 5 insertions(+), 12 deletions(-)

diff --git a/include/i18n.h b/include/i18n.h
index 5407081..251b506 100644
--- a/include/i18n.h
+++ b/include/i18n.h
@@ -31,8 +31,8 @@
 * that should be translated to the user.
 * It obtains the current locale from environment variables,
 * See setlocale (3) for more information.
-* If the initialization support fails, this function will exit the
-* program after printing an error message.
+* If the initialization support fails, this function will print
+* an error message.
 */
 
 void i18n_init(void);
diff --git a/src/common/i18n.c b/src/common/i18n.c
index 908ab8e..c0d810b 100644
--- a/src/common/i18n.c
+++ b/src/common/i18n.c
@@ -1,7 +1,7 @@
 /*
  * i18n.c - internationalization support for Speech-dispatcher
  *
- * Copyright (C) 2010 Brailcom, o.p.s.
+ * Copyright (C) 2010, 2012 Brailcom, o.p.s.
  *
  * This is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by
@@ -33,16 +33,9 @@ void i18n_init(void)
 {
        if (setlocale(LC_ALL, "") == NULL) {
                perror("setlocale");
-               exit(1);
-       }
-
-       if (bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR) == NULL) {
+       } else if (bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR) == NULL) {
                perror("bindtextdomain");
-               exit(1);
-       }
-
-       if (textdomain(GETTEXT_PACKAGE) == NULL) {
+       } else if (textdomain(GETTEXT_PACKAGE) == NULL) {
                perror("textdomain");
-               exit(1);
        }
 }
-- 
1.7.9.6 (Apple Git-31.1)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]