-/* Copyright (C) 1998,1999,2000,2001,2002,2005 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
# include <config.h>
#endif
-#include <error.h>
#include <langinfo.h>
#include <string.h>
+#include <stdint.h>
#include <sys/uio.h>
#include <assert.h>
empty one. */
if (telephone == NULL)
{
- if (! be_quiet)
- WITH_CUR_LOCALE (error (0, 0, _("\
-No definition for %s category found"), "LC_TELEPHONE"));
+ record_warning (_("\
+No definition for %s category found"), "LC_TELEPHONE");
telephone_startup (NULL, locale, 0);
telephone = locale->categories[LC_TELEPHONE].telephone;
nothing = 1;
if (telephone->tel_int_fmt == NULL)
{
if (! nothing)
- WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"),
- "LC_TELEPHONE", "tel_int_fmt"));
+ record_error (0, 0, _("%s: field `%s' not defined"),
+ "LC_TELEPHONE", "tel_int_fmt");
/* Use as the default value the value of the i18n locale. */
- telephone->tel_int_fmt = "+%c %a %l";
+ telephone->tel_int_fmt = "+%c %a%t%l";
}
else
{
const char *cp = telephone->tel_int_fmt;
if (*cp == '\0')
- WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' must not be empty"),
- "LC_TELEPHONE", "tel_int_fmt"));
+ record_error (0, 0, _("%s: field `%s' must not be empty"),
+ "LC_TELEPHONE", "tel_int_fmt");
else
while (*cp != '\0')
{
if (*cp == '%')
{
- if (strchr ("aAlc", *++cp) == NULL)
+ if (strchr ("aAcCelt", *++cp) == NULL)
{
- WITH_CUR_LOCALE (error (0, 0, _("\
-%s: invalid escape sequence in field `%s'"), "LC_TELEPHONE", "tel_int_fmt"));
+ record_error (0, 0, _("\
+%s: invalid escape sequence in field `%s'"), "LC_TELEPHONE", "tel_int_fmt");
break;
}
}
{
if (*cp == '%')
{
- if (strchr ("aAlc", *++cp) == NULL)
+ if (strchr ("aAcCelt", *++cp) == NULL)
{
- WITH_CUR_LOCALE (error (0, 0, _("\
-%s: invalid escape sequence in field `%s'"), "LC_TELEPHONE", "tel_dom_fmt"));
+ record_error (0, 0, _("\
+%s: invalid escape sequence in field `%s'"), "LC_TELEPHONE", "tel_dom_fmt");
break;
}
}
if (telephone->cat == NULL) \
{ \
if (verbose && ! nothing) \
- WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"), \
- "LC_TELEPHONE", #cat)); \
+ record_warning (_("%s: field `%s' not defined"), "LC_TELEPHONE", \
+ #cat); \
telephone->cat = ""; \
}
{
struct locale_telephone_t *telephone =
locale->categories[LC_TELEPHONE].telephone;
- struct iovec iov[2 + _NL_ITEM_INDEX (_NL_NUM_LC_TELEPHONE)];
- struct locale_file data;
- uint32_t idx[_NL_ITEM_INDEX (_NL_NUM_LC_TELEPHONE)];
- size_t cnt = 0;
-
- data.magic = LIMAGIC (LC_TELEPHONE);
- data.n = _NL_ITEM_INDEX (_NL_NUM_LC_TELEPHONE);
- iov[cnt].iov_base = (void *) &data;
- iov[cnt].iov_len = sizeof (data);
- ++cnt;
-
- iov[cnt].iov_base = (void *) idx;
- iov[cnt].iov_len = sizeof (idx);
- ++cnt;
-
- idx[cnt - 2] = iov[0].iov_len + iov[1].iov_len;
- iov[cnt].iov_base = (void *) telephone->tel_int_fmt;
- iov[cnt].iov_len = strlen (iov[cnt].iov_base) + 1;
- ++cnt;
-
- idx[cnt - 2] = idx[cnt - 3] + iov[cnt - 1].iov_len;
- iov[cnt].iov_base = (void *) telephone->tel_dom_fmt;
- iov[cnt].iov_len = strlen (iov[cnt].iov_base) + 1;
- ++cnt;
-
- idx[cnt - 2] = idx[cnt - 3] + iov[cnt - 1].iov_len;
- iov[cnt].iov_base = (void *) telephone->int_select;
- iov[cnt].iov_len = strlen (iov[cnt].iov_base) + 1;
- ++cnt;
-
- idx[cnt - 2] = idx[cnt - 3] + iov[cnt - 1].iov_len;
- iov[cnt].iov_base = (void *) telephone->int_prefix;
- iov[cnt].iov_len = strlen (iov[cnt].iov_base) + 1;
- ++cnt;
-
- idx[cnt - 2] = idx[cnt - 3] + iov[cnt - 1].iov_len;
- iov[cnt].iov_base = (void *) charmap->code_set_name;;
- iov[cnt].iov_len = strlen (iov[cnt].iov_base) + 1;
- ++cnt;
-
- assert (cnt == 2 + _NL_ITEM_INDEX (_NL_NUM_LC_TELEPHONE));
-
- write_locale_data (output_path, LC_TELEPHONE, "LC_TELEPHONE",
- 2 + _NL_ITEM_INDEX (_NL_NUM_LC_TELEPHONE), iov);
+ struct locale_file file;
+
+ init_locale_data (&file, _NL_ITEM_INDEX (_NL_NUM_LC_TELEPHONE));
+ add_locale_string (&file, telephone->tel_int_fmt);
+ add_locale_string (&file, telephone->tel_dom_fmt);
+ add_locale_string (&file, telephone->int_select);
+ add_locale_string (&file, telephone->int_prefix);
+ add_locale_string (&file, charmap->code_set_name);
+ write_locale_data (output_path, LC_TELEPHONE, "LC_TELEPHONE", &file);
}