diff options
Diffstat (limited to 'locale')
-rw-r--r-- | locale/programs/charmap.c | 7 | ||||
-rw-r--r-- | locale/programs/ld-collate.c | 23 | ||||
-rw-r--r-- | locale/programs/ld-ctype.c | 145 | ||||
-rw-r--r-- | locale/programs/ld-messages.c | 22 | ||||
-rw-r--r-- | locale/programs/ld-monetary.c | 13 | ||||
-rw-r--r-- | locale/programs/ld-time.c | 96 | ||||
-rw-r--r-- | locale/programs/locfile.c | 16 |
7 files changed, 196 insertions, 126 deletions
diff --git a/locale/programs/charmap.c b/locale/programs/charmap.c index 1573d6c002..0cd62fbfd4 100644 --- a/locale/programs/charmap.c +++ b/locale/programs/charmap.c @@ -253,11 +253,12 @@ parse_charmap (const char *filename) result->mb_cur_max = 1; if (result->mb_cur_min == 0) result->mb_cur_min = result->mb_cur_max; - if (result->mb_cur_min > result->mb_cur_max && !be_quiet) + if (result->mb_cur_min > result->mb_cur_max) { - error (0, 0, _("\ + if (!be_quiet) + error (0, 0, _("\ %s: <mb_cur_max> must be greater than <mb_cur_min>\n"), - cmfile->fname); + cmfile->fname); result->mb_cur_min = result->mb_cur_max; } diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c index 78a9cd92ac..57b97767af 100644 --- a/locale/programs/ld-collate.c +++ b/locale/programs/ld-collate.c @@ -239,9 +239,13 @@ collate_finish (struct localedef_t *locale, struct charset_t *charset) else value = 0; - if (value == 0 && !be_quiet) - error_at_line (0, 0, patch->fname, patch->lineno, - _("no weight defined for symbol `%s'"), patch->token); + if (value == 0) + { + if (!be_quiet) + error_at_line (0, 0, patch->fname, patch->lineno, + _("no weight defined for symbol `%s'"), + patch->token); + } else *patch->where.pos = value; } @@ -1477,7 +1481,7 @@ line after ellipsis must contain character definition")); pelem->ordering = (unsigned int *) obstack_copy (&collate->element_mem, data, (collate->nrules - * pelem->ordering_len) + + pelem->ordering_len) * sizeof (unsigned int)); /* `...' weights need to be adjusted. */ @@ -1490,13 +1494,16 @@ line after ellipsis must contain character definition")); (void *) &pelem->next) >= 0) { if (set_entry (&collate->result, name, sizeof (wchar_t), - (void *) pelem->next) < 0) + (void *) pelem) < 0) error (4, 0, _("cannot insert into result table")); } else - if (insert_entry (&collate->result, name, sizeof (wchar_t), - (void *) pelem->next) < 0) - error (4, 0, _("cannot insert into result table")); + { + pelem->next = NULL; + if (insert_entry (&collate->result, name, sizeof (wchar_t), + (void *) pelem) < 0) + error (4, 0, _("cannot insert into result table")); + } /* Increment counter. */ ++name[0]; diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c index 8ab70abb5a..f2f32cc214 100644 --- a/locale/programs/ld-ctype.c +++ b/locale/programs/ld-ctype.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. @@ -309,27 +309,34 @@ character %s'%s' in class `%s' must not be in class `%s'"), /* ... and now test <SP> as a special case. */ space_value = charset_find_value (charset, "SP", 2); - if ((wchar_t) space_value == ILLEGAL_CHAR_VALUE && !be_quiet) - error (0, 0, _("character <SP> not defined in character map")); + if ((wchar_t) space_value == ILLEGAL_CHAR_VALUE) + { + if (!be_quiet) + error (0, 0, _("character <SP> not defined in character map")); + } else if (((cnt = BITPOS (tok_space), (ELEM (ctype, class_collection, , space_value) & BIT (tok_space)) == 0) || (cnt = BITPOS (tok_blank), (ELEM (ctype, class_collection, , space_value) - & BIT (tok_blank)) == 0)) - && !be_quiet) - error (0, 0, _("<SP> character not in class `%s'"), - valid_table[cnt].name); + & BIT (tok_blank)) == 0))) + { + if (!be_quiet) + error (0, 0, _("<SP> character not in class `%s'"), + valid_table[cnt].name); + } else if (((cnt = BITPOS (tok_punct), (ELEM (ctype, class_collection, , space_value) & BIT (tok_punct)) != 0) || (cnt = BITPOS (tok_graph), (ELEM (ctype, class_collection, , space_value) & BIT (tok_graph)) - != 0)) - && !be_quiet) - error (0, 0, _("<SP> character must not be in class `%s'"), - valid_table[cnt].name); + != 0))) + { + if (!be_quiet) + error (0, 0, _("<SP> character must not be in class `%s'"), + valid_table[cnt].name); + } else ELEM (ctype, class_collection, , space_value) |= BIT (tok_print); @@ -651,12 +658,14 @@ ctype_class_to (struct linereader *lr, struct localedef_t *locale, value = charset_find_value (charset, code->val.str.start, code->val.str.len); - assert (value >= ctype->last_class_char); - - for (cnt = ctype->last_class_char + 1; cnt <= value; ++cnt) - *find_idx (ctype, &ctype->class_collection, &ctype->class_collection_max, - &ctype->class_collection_act, cnt) - |= ctype->current_class_mask; + /* In the LC_CTYPE category it is no error when a character is + not found. This has to be ignored silently. */ + if ((wchar_t) ctype->last_class_char != ILLEGAL_CHAR_VALUE + && (wchar_t) value != ILLEGAL_CHAR_VALUE) + for (cnt = ctype->last_class_char + 1; cnt <= value; ++cnt) + *find_idx (ctype, &ctype->class_collection, &ctype->class_collection_max, + &ctype->class_collection_act, cnt) + |= ctype->current_class_mask; ctype->last_class_char = ILLEGAL_CHAR_VALUE; } @@ -940,11 +949,12 @@ set_class_defaults (struct locale_ctype_t *ctype, struct charset_t *charset) tmp[0] = ch; value = charset_find_value (charset, tmp, 1); - if ((wchar_t) value == ILLEGAL_CHAR_VALUE && !be_quiet) + if ((wchar_t) value == ILLEGAL_CHAR_VALUE) { - error (0, 0, _("\ + if (!be_quiet) + error (0, 0, _("\ character `%s' not defined while needed as default value"), - tmp); + tmp); continue; } else @@ -1004,50 +1014,68 @@ character `%s' not defined while needed as default value"), unsigned int value; value = charset_find_value (charset, "space", 5); - if ((wchar_t) value == ILLEGAL_CHAR_VALUE && !be_quiet) - error (0, 0, _("\ + if ((wchar_t) value == ILLEGAL_CHAR_VALUE) + { + if (!be_quiet) + error (0, 0, _("\ character `%s' not defined while needed as default value"), - "<space>"); + "<space>"); + } else ELEM (ctype, class_collection, , value) |= BIT (tok_space); value = charset_find_value (charset, "form-feed", 9); - if ((wchar_t) value == ILLEGAL_CHAR_VALUE && !be_quiet) - error (0, 0, _("\ + if ((wchar_t) value == ILLEGAL_CHAR_VALUE) + { + if (!be_quiet) + error (0, 0, _("\ character `%s' not defined while needed as default value"), - "<form-feed>"); + "<form-feed>"); + } else ELEM (ctype, class_collection, , value) |= BIT (tok_space); value = charset_find_value (charset, "newline", 7); - if ((wchar_t) value == ILLEGAL_CHAR_VALUE && !be_quiet) - error (0, 0, _("\ + if ((wchar_t) value == ILLEGAL_CHAR_VALUE) + { + if (!be_quiet) + error (0, 0, _("\ character `%s' not defined while needed as default value"), - "<newline>"); + "<newline>"); + } else ELEM (ctype, class_collection, , value) |= BIT (tok_space); value = charset_find_value (charset, "carriage-return", 15); - if ((wchar_t) value == ILLEGAL_CHAR_VALUE && !be_quiet) - error (0, 0, _("\ + if ((wchar_t) value == ILLEGAL_CHAR_VALUE) + { + if (!be_quiet) + error (0, 0, _("\ character `%s' not defined while needed as default value"), - "<carriage-return>"); + "<carriage-return>"); + } else ELEM (ctype, class_collection, , value) |= BIT (tok_space); value = charset_find_value (charset, "tab", 3); - if ((wchar_t) value == ILLEGAL_CHAR_VALUE && !be_quiet) - error (0, 0, _("\ + if ((wchar_t) value == ILLEGAL_CHAR_VALUE) + { + if (!be_quiet) + error (0, 0, _("\ character `%s' not defined while needed as default value"), - "<tab>"); + "<tab>"); + } else ELEM (ctype, class_collection, , value) |= BIT (tok_space); value = charset_find_value (charset, "vertical-tab", 12); - if ((wchar_t) value == ILLEGAL_CHAR_VALUE && !be_quiet) - error (0, 0, _("\ + if ((wchar_t) value == ILLEGAL_CHAR_VALUE) + { + if (!be_quiet) + error (0, 0, _("\ character `%s' not defined while needed as default value"), - "<vertical-tab>"); + "<vertical-tab>"); + } else ELEM (ctype, class_collection, , value) |= BIT (tok_space); } @@ -1070,18 +1098,24 @@ character `%s' not defined while needed as default value"), unsigned int value; value = charset_find_value (charset, "space", 5); - if ((wchar_t) value == ILLEGAL_CHAR_VALUE && !be_quiet) - error (0, 0, _("\ + if ((wchar_t) value == ILLEGAL_CHAR_VALUE) + { + if (!be_quiet) + error (0, 0, _("\ character `%s' not defined while needed as default value"), - "<space>"); + "<space>"); + } else ELEM (ctype, class_collection, , value) |= BIT (tok_blank); value = charset_find_value (charset, "tab", 3); - if ((wchar_t) value == ILLEGAL_CHAR_VALUE && !be_quiet) - error (0, 0, _("\ + if ((wchar_t) value == ILLEGAL_CHAR_VALUE) + { + if (!be_quiet) + error (0, 0, _("\ character `%s' not defined while needed as default value"), - "<tab>"); + "<tab>"); + } else ELEM (ctype, class_collection, , value) |= BIT (tok_blank); } @@ -1116,10 +1150,13 @@ character `%s' not defined while needed as default value"), ctype->class_collection[cnt] |= BIT (tok_print); space = charset_find_value (charset, "space", 5); - if (space == ILLEGAL_CHAR_VALUE && !be_quiet) - error (0, 0, _("\ + if (space == ILLEGAL_CHAR_VALUE) + { + if (!be_quiet) + error (0, 0, _("\ character `%s' not defined while needed as default value"), - "<space>"); + "<space>"); + } else ELEM (ctype, class_collection, , space) |= BIT (tok_print); } @@ -1142,22 +1179,24 @@ character `%s' not defined while needed as default value"), tmp[1] = (char) ch; value_from = charset_find_value (charset, &tmp[1], 1); - if ((wchar_t) value_from == ILLEGAL_CHAR_VALUE && !be_quiet) + if ((wchar_t) value_from == ILLEGAL_CHAR_VALUE) { - error (0, 0, _("\ + if (!be_quiet) + error (0, 0, _("\ character `%s' not defined while needed as default value"), - tmp); + tmp); continue; } /* This conversion is implementation defined. */ tmp[1] = (char) (ch + ('A' - 'a')); value_to = charset_find_value (charset, &tmp[1], 1); - if ((wchar_t) value_to == ILLEGAL_CHAR_VALUE && !be_quiet) + if ((wchar_t) value_to == ILLEGAL_CHAR_VALUE) { - error (0, 0, _("\ + if (!be_quiet) + error (0, 0, _("\ character `%s' not defined while needed as default value"), - tmp); + tmp); continue; } diff --git a/locale/programs/ld-messages.c b/locale/programs/ld-messages.c index 31edb47a60..9353e1e49e 100644 --- a/locale/programs/ld-messages.c +++ b/locale/programs/ld-messages.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. @@ -41,7 +41,7 @@ #include "localeinfo.h" -void *xmalloc (size_t __n); +extern void *xmalloc (size_t __n); /* The real definition of the struct for the LC_MESSAGES locale. */ @@ -77,9 +77,12 @@ messages_finish (struct localedef_t *locale) = locale->categories[LC_MESSAGES].messages; /* The fields YESSTR and NOSTR are optional. */ - if (messages->yesexpr == NULL && !be_quiet) - error (0, 0, _("field `%s' in category `%s' undefined"), - "yesexpr", "LC_MESSAGES"); + if (messages->yesexpr == NULL) + { + if (!be_quiet) + error (0, 0, _("field `%s' in category `%s' undefined"), + "yesexpr", "LC_MESSAGES"); + } else { int result; @@ -98,9 +101,12 @@ no correct regular expression for field `%s' in category `%s': %s"), } } - if (messages->noexpr == NULL && !be_quiet) - error (0, 0, _("field `%s' in category `%s' undefined"), - "noexpr", "LC_MESSAGES"); + if (messages->noexpr == NULL) + { + if (!be_quiet) + error (0, 0, _("field `%s' in category `%s' undefined"), + "noexpr", "LC_MESSAGES"); + } else { int result; diff --git a/locale/programs/ld-monetary.c b/locale/programs/ld-monetary.c index cd30125a5a..d202d76399 100644 --- a/locale/programs/ld-monetary.c +++ b/locale/programs/ld-monetary.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. @@ -35,8 +35,8 @@ #include "localeinfo.h" #include "stringtrans.h" -void *xmalloc (size_t __n); -void *xrealloc (void *__ptr, size_t __n); +extern void *xmalloc (size_t __n); +extern void *xrealloc (void *__ptr, size_t __n); /* The real definition of the struct for the LC_NUMERIC locale. */ @@ -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 60c54deb3a..e16a247430 100644 --- a/locale/programs/ld-time.c +++ b/locale/programs/ld-time.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. @@ -37,8 +37,8 @@ (((w) << 24) | (((w) & 0xff00) << 8) | (((w) >> 8) & 0xff00) | ((w) >> 24)) -void *xmalloc (size_t __n); -void *xrealloc (void *__p, size_t __n); +extern void *xmalloc (size_t __n); +extern void *xrealloc (void *__p, size_t __n); /* Entry describing an entry of the era specification. */ @@ -154,21 +154,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 @@ -176,18 +178,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 @@ -229,20 +233,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 @@ -302,20 +309,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 @@ -339,10 +349,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 = ""; } @@ -350,11 +361,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 6385df47e8..ad7e9d5fb4 100644 --- a/locale/programs/locfile.c +++ b/locale/programs/locfile.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996. @@ -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; } } |