diff options
Diffstat (limited to 'src/catalog.c')
-rw-r--r-- | src/catalog.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/catalog.c b/src/catalog.c index e56ca0b..6c3bdad 100644 --- a/src/catalog.c +++ b/src/catalog.c @@ -27,13 +27,12 @@ NLSPATH_KEY = "NLSPATH"; int i18n_init(void) { - int rc = 0; + int rc = -1; static const int should_overwrite = 0; if (setenv(NLSPATH_KEY, NLSPATH, should_overwrite)) { logerr("setenv(\"%s\", \"%s\", 0): %s\n", NLSPATH_KEY, NLSPATH, strerror(errno)); - rc = -1; goto out; } @@ -41,26 +40,26 @@ i18n_init(void) { if (catalog_descriptor && catalog_descriptor == (nl_catd)-1) { logerr("catopen(\"%s\", 0): %s\n", CATALOG_NAME, strerror(errno)); catalog_descriptor = NULL; - rc = -1; goto out; } + rc = 0; out: return rc; } int i18n_destroy(void) { - int rc = 0; + int rc = -1; if (catalog_descriptor) { if (catclose(catalog_descriptor)) { logerr("catclose(...): %s\n", strerror(errno)); - rc = -1; goto out; } } + rc = 0; out: if (catalog_descriptor) { catalog_descriptor = NULL; @@ -97,17 +96,17 @@ s_print_msgs( const int msg_begin, const int msg_end ) { - int rc = 0; + int rc = -1; for (int i = msg_begin; i <= msg_end; i++) { if (fprintf(stream, "%s", s(MSGS, i)) < 0) { logerr("fprintf(stream, \"%%s\", _(%d)): %s\n", i, strerror(errno)); - rc = -1; goto out; } } + rc = 0; out: return rc; } @@ -119,12 +118,11 @@ s_print_msg(const char *const MSGS[], FILE *const fd, const int msg_id) { int dump_translatable_strings(const char *const MSGS[]) { - int rc = 0; + int rc = -1; for (size_t i = 1; MSGS[i]; i++) { if (printf("%ld ", i) < 0) { logerr("printf(\"%%ld\", %d): %s\n", i); - rc = -1; goto out; } @@ -133,7 +131,6 @@ dump_translatable_strings(const char *const MSGS[]) { if (printf("\\n") < 0) { logerr("printf(\"\\\\n\"): %s\n", strerror(errno)); - rc = -1; goto out; } } else { @@ -141,7 +138,6 @@ dump_translatable_strings(const char *const MSGS[]) { logerr("printf(\"%%c\", " "MSGS[%ld][%ld]): %s\n", i, j, strerror(errno)); - rc = -1; goto out; } } @@ -149,11 +145,11 @@ dump_translatable_strings(const char *const MSGS[]) { if (printf("\n\n") < 0) { logerr("printf(\"\\n\\n\"): %s\n", strerror(errno)); - rc = -1; goto out; } } + rc = 0; out: return rc; } |