From a4838496a695ae1db01bf22605d24079e1773aba Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Mon, 2 Mar 1998 13:35:00 +0000 Subject: [PATCH] Don't skip error checking when being quiet. --- locale/programs/ld-monetary.c | 7 +++- locale/programs/ld-time.c | 90 ++++++++++++++++++++++++------------------- locale/programs/locfile.c | 14 ++++--- 3 files changed, 64 insertions(+), 47 deletions(-) diff --git a/locale/programs/ld-monetary.c b/locale/programs/ld-monetary.c index 2c5bb7385d..46a21aa559 100644 --- a/locale/programs/ld-monetary.c +++ b/locale/programs/ld-monetary.c @@ -129,9 +129,12 @@ monetary_finish (struct localedef_t *locale) /* The international currency symbol must come from ISO 4217. */ if (monetary->int_curr_symbol != NULL) { - if (strlen (monetary->int_curr_symbol) != 4 && !be_quiet) - error (0, 0, _("\ + if (strlen (monetary->int_curr_symbol) != 4) + { + if (!be_quiet) + error (0, 0, _("\ value of field `int_curr_symbol' in category `LC_MONETARY' has wrong length")); + } else if (bsearch (monetary->int_curr_symbol, valid_int_curr, NR_VALID_INT_CURR, sizeof (const char *), (comparison_fn_t) curr_strcmp) == NULL diff --git a/locale/programs/ld-time.c b/locale/programs/ld-time.c index 31ff6ffe85..54e7c9410a 100644 --- a/locale/programs/ld-time.c +++ b/locale/programs/ld-time.c @@ -149,21 +149,23 @@ time_finish (struct localedef_t *locale) memcpy (str, time->era[idx], era_len + 1); /* First character must be + or - for the direction. */ - if (*str != '+' && *str != '-' && !be_quiet) + if (*str != '+' && *str != '-') { - error (0, 0, _("direction flag in string %d in `era' field" - " in category `%s' is not '+' nor '-'"), - idx + 1, "LC_TIME"); + if (!be_quiet) + error (0, 0, _("direction flag in string %d in `era' field" + " in category `%s' is not '+' nor '-'"), + idx + 1, "LC_TIME"); /* Default arbitrarily to '+'. */ time->era_entries[idx].direction = '+'; } else time->era_entries[idx].direction = *str; - if (*++str != ':' && !be_quiet) + if (*++str != ':') { - error (0, 0, _("direction flag in string %d in `era' field" - " in category `%s' is not a single character"), - idx + 1, "LC_TIME"); + if (!be_quiet) + error (0, 0, _("direction flag in string %d in `era' field" + " in category `%s' is not a single character"), + idx + 1, "LC_TIME"); (void) strsep (&str, ":"); } else @@ -171,18 +173,20 @@ time_finish (struct localedef_t *locale) /* Now the offset year. */ time->era_entries[idx].offset = strtol (str, &endp, 10); - if (endp == str && !be_quiet) + if (endp == str) { - error (0, 0, _("illegal number for offset in string %d in" - " `era' field in category `%s'"), - idx + 1, "LC_TIME"); + if (!be_quiet) + error (0, 0, _("illegal number for offset in string %d in" + " `era' field in category `%s'"), + idx + 1, "LC_TIME"); (void) strsep (&str, ":"); } - else if (*endp != ':' && !be_quiet) + else if (*endp != ':') { - error (0, 0, _("garbage at end of offset value in string %d in" - " `era' field in category `%s'"), - idx + 1, "LC_TIME"); + if (!be_quiet) + error (0, 0, _("garbage at end of offset value in string %d in" + " `era' field in category `%s'"), + idx + 1, "LC_TIME"); (void) strsep (&str, ":"); } else @@ -224,20 +228,23 @@ time_finish (struct localedef_t *locale) time->era_entries[idx].start_date[1] -= 1; time->era_entries[idx].start_date[2] = strtol (str, &endp, 10); - if (endp == str && !be_quiet) + if (endp == str) { invalid_start_date: - error (0, 0, _("illegal starting date in string %d in" - " `era' field in category `%s'"), - idx + 1, "LC_TIME"); + if (!be_quiet) + error (0, 0, _("illegal starting date in string %d in" + " `era' field in category `%s'"), + idx + 1, "LC_TIME"); (void) strsep (&str, ":"); } - else if (*endp != ':' && !be_quiet) + else if (*endp != ':') { garbage_start_date: - error (0, 0, _("garbage at end of starting date in string %d" - " in `era' field in category `%s'"), - idx + 1, "LC_TIME"); + if (!be_quiet) + error (0, 0, _("garbage at end of starting date " + "in string %d in `era' field " + "in category `%s'"), + idx + 1, "LC_TIME"); (void) strsep (&str, ":"); } else @@ -297,20 +304,23 @@ time_finish (struct localedef_t *locale) time->era_entries[idx].stop_date[1] -= 1; time->era_entries[idx].stop_date[2] = strtol (str, &endp, 10); - if (endp == str && !be_quiet) + if (endp == str) { invalid_stop_date: - error (0, 0, _("illegal stopping date in string %d in" - " `era' field in category `%s'"), - idx + 1, "LC_TIME"); + if (!be_quiet) + error (0, 0, _("illegal stopping date in string %d in" + " `era' field in category `%s'"), + idx + 1, "LC_TIME"); (void) strsep (&str, ":"); } - else if (*endp != ':' && !be_quiet) + else if (*endp != ':') { garbage_stop_date: - error (0, 0, _("garbage at end of stopping date in string %d" - " in `era' field in category `%s'"), - idx + 1, "LC_TIME"); + if (!be_quiet) + error (0, 0, _("garbage at end of stopping date " + "in string %d in `era' field " + "in category `%s'"), + idx + 1, "LC_TIME"); (void) strsep (&str, ":"); } else @@ -334,10 +344,11 @@ time_finish (struct localedef_t *locale) } } - if ((str == NULL || *str == '\0') && !be_quiet) + if ((str == NULL || *str == '\0')) { - error (0, 0, _("missing era name in string %d in `era' field" - " in category `%s'"), idx + 1, "LC_TIME"); + if (!be_quiet) + error (0, 0, _("missing era name in string %d in `era' field" + " in category `%s'"), idx + 1, "LC_TIME"); time->era_entries[idx].name = time->era_entries[idx].format = ""; } @@ -345,11 +356,12 @@ time_finish (struct localedef_t *locale) { time->era_entries[idx].name = strsep (&str, ":"); - if ((str == NULL || *str == '\0') && !be_quiet) + if ((str == NULL || *str == '\0')) { - error (0, 0, _("missing era format in string %d in `era'" - " field in category `%s'"), - idx + 1, "LC_TIME"); + if (!be_quiet) + error (0, 0, _("missing era format in string %d in `era'" + " field in category `%s'"), + idx + 1, "LC_TIME"); time->era_entries[idx].name = time->era_entries[idx].format = ""; } diff --git a/locale/programs/locfile.c b/locale/programs/locfile.c index 7749f6aebc..442535c2a6 100644 --- a/locale/programs/locfile.c +++ b/locale/programs/locfile.c @@ -1015,11 +1015,12 @@ write_locale_data (const char *output_path, const char *category, save_err = errno; } - if (fd == -1 && !be_quiet) + if (fd == -1) { - error (0, save_err, _("\ + if (!be_quiet) + error (0, save_err, _("\ cannot open output file `%s' for category `%s'"), - fname, category); + fname, category); return; } } @@ -1039,10 +1040,11 @@ cannot open output file `%s' for category `%s'"), if (maxiov > 0) step = MIN (maxiov, step); - if (writev (fd, &vec[cnt], step) < 0 && !be_quiet) + if (writev (fd, &vec[cnt], step) < 0) { - error (0, errno, _("failure while writing data for category `%s'"), - category); + if (!be_quiet) + error (0, errno, _("failure while writing data for category `%s'"), + category); break; } } -- 2.11.4.GIT