summaryrefslogtreecommitdiff
path: root/locale/programs
diff options
context:
space:
mode:
Diffstat (limited to 'locale/programs')
-rw-r--r--locale/programs/3level.h2
-rw-r--r--locale/programs/charmap-dir.c10
-rw-r--r--locale/programs/charmap-dir.h2
-rw-r--r--locale/programs/charmap-kw.gperf2
-rw-r--r--locale/programs/charmap-kw.h2
-rw-r--r--locale/programs/charmap.c45
-rw-r--r--locale/programs/charmap.h2
-rw-r--r--locale/programs/config.h2
-rw-r--r--locale/programs/ld-address.c102
-rw-r--r--locale/programs/ld-collate.c66
-rw-r--r--locale/programs/ld-ctype.c264
-rw-r--r--locale/programs/ld-identification.c59
-rw-r--r--locale/programs/ld-measurement.c16
-rw-r--r--locale/programs/ld-messages.c37
-rw-r--r--locale/programs/ld-monetary.c76
-rw-r--r--locale/programs/ld-name.c22
-rw-r--r--locale/programs/ld-numeric.c25
-rw-r--r--locale/programs/ld-paper.c16
-rw-r--r--locale/programs/ld-telephone.c34
-rw-r--r--locale/programs/ld-time.c143
-rw-r--r--locale/programs/linereader.c10
-rw-r--r--locale/programs/linereader.h28
-rw-r--r--locale/programs/locale-spec.c4
-rw-r--r--locale/programs/locale.c10
-rw-r--r--locale/programs/localedef.c142
-rw-r--r--locale/programs/localedef.h22
-rw-r--r--locale/programs/locarchive.c12
-rw-r--r--locale/programs/locfile-kw.gperf4
-rw-r--r--locale/programs/locfile-kw.h114
-rw-r--r--locale/programs/locfile-token.h4
-rw-r--r--locale/programs/locfile.c17
-rw-r--r--locale/programs/locfile.h2
-rw-r--r--locale/programs/record-status.c229
-rw-r--r--locale/programs/record-status.h51
-rw-r--r--locale/programs/repertoire.c13
-rw-r--r--locale/programs/repertoire.h2
-rw-r--r--locale/programs/simple-hash.c2
-rw-r--r--locale/programs/simple-hash.h2
-rw-r--r--locale/programs/xmalloc.c2
-rw-r--r--locale/programs/xstrdup.c2
40 files changed, 966 insertions, 633 deletions
diff --git a/locale/programs/3level.h b/locale/programs/3level.h
index 19c7daf731..836dba5d5d 100644
--- a/locale/programs/3level.h
+++ b/locale/programs/3level.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2016 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Bruno Haible <haible@clisp.cons.org>, 2000.
diff --git a/locale/programs/charmap-dir.c b/locale/programs/charmap-dir.c
index 99fcd355e0..34a8d32c92 100644
--- a/locale/programs/charmap-dir.c
+++ b/locale/programs/charmap-dir.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2016 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
This program is free software; you can redistribute it and/or modify
@@ -16,7 +16,6 @@
#include <dirent.h>
#include <errno.h>
-#include <error.h>
#include <fcntl.h>
#include <libintl.h>
#include <spawn.h>
@@ -54,8 +53,9 @@ charmap_opendir (const char *directory)
dir = opendir (directory);
if (dir == NULL)
{
- WITH_CUR_LOCALE (error (1, errno, gettext ("\
-cannot read character map directory `%s'"), directory));
+ record_error (1, errno, gettext ("\
+cannot read character map directory `%s'"),
+ directory);
return NULL;
}
@@ -115,11 +115,9 @@ charmap_readdir (CHARMAP_DIR *cdir)
stpcpy (stpcpy (cdir->pathname, cdir->directory), dirent->d_name);
filename = cdir->pathname + cdir->directory_len;
-#ifdef _DIRENT_HAVE_D_TYPE
if (dirent->d_type != DT_UNKNOWN && dirent->d_type != DT_LNK)
mode = DTTOIF (dirent->d_type);
else
-#endif
{
struct stat64 statbuf;
diff --git a/locale/programs/charmap-dir.h b/locale/programs/charmap-dir.h
index c8c916b4f6..95a7d1f88c 100644
--- a/locale/programs/charmap-dir.h
+++ b/locale/programs/charmap-dir.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2016 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
This program is free software; you can redistribute it and/or modify
diff --git a/locale/programs/charmap-kw.gperf b/locale/programs/charmap-kw.gperf
index 96cebcd721..4c9512a02a 100644
--- a/locale/programs/charmap-kw.gperf
+++ b/locale/programs/charmap-kw.gperf
@@ -1,5 +1,5 @@
%{
-/* Copyright (C) 1995-2016 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper, <drepper@gnu.org>.
diff --git a/locale/programs/charmap-kw.h b/locale/programs/charmap-kw.h
index 983d287880..0b3ed749fa 100644
--- a/locale/programs/charmap-kw.h
+++ b/locale/programs/charmap-kw.h
@@ -30,7 +30,7 @@
#line 1 "charmap-kw.gperf"
-/* Copyright (C) 1995-2016 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper, <drepper@gnu.org>.
diff --git a/locale/programs/charmap.c b/locale/programs/charmap.c
index d7580e05c4..2d54dd3c02 100644
--- a/locale/programs/charmap.c
+++ b/locale/programs/charmap.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2016 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
@@ -26,7 +26,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <error.h>
#include <stdint.h>
#include "localedef.h"
@@ -135,8 +134,9 @@ charmap_read (const char *filename, int verbose, int error_not_found,
result = parse_charmap (cmfile, verbose, be_quiet);
if (result == NULL && error_not_found)
- WITH_CUR_LOCALE (error (0, errno, _("\
-character map file `%s' not found"), filename));
+ record_error (0, errno,
+ _("character map file `%s' not found"),
+ filename);
}
if (result == NULL && filename != NULL && strchr (filename, '/') == NULL)
@@ -192,8 +192,9 @@ character map file `%s' not found"), filename));
result = parse_charmap (cmfile, verbose, be_quiet);
if (result == NULL)
- WITH_CUR_LOCALE (error (4, errno, _("\
-default character map file `%s' not found"), DEFAULT_CHARMAP));
+ record_error (4, errno,
+ _("default character map file `%s' not found"),
+ DEFAULT_CHARMAP);
}
if (result != NULL && result->code_set_name == NULL)
@@ -255,9 +256,15 @@ default character map file `%s' not found"), DEFAULT_CHARMAP));
if (failed)
{
- WITH_CUR_LOCALE (fprintf (stderr, _("\
-character map `%s' is not ASCII compatible, locale not ISO C compliant\n"),
- result->code_set_name));
+ /* A user may disable the ASCII compatibility warning check,
+ but we must remember that the encoding is not ASCII
+ compatible, since it may have other implications. Later
+ we will set _NL_CTYPE_MAP_TO_NONASCII from this value. */
+ if (warn_ascii)
+ record_warning (_(
+"character map `%s' is not ASCII compatible, locale not ISO C compliant "
+"[--no-warnings=ascii]"),
+ result->code_set_name);
enc_not_ascii_compatible = true;
}
}
@@ -333,10 +340,9 @@ parse_charmap (struct linereader *cmfile, int verbose, int be_quiet)
result->mb_cur_min = result->mb_cur_max;
if (result->mb_cur_min > result->mb_cur_max)
{
- if (!be_quiet)
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_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;
}
@@ -395,11 +401,10 @@ parse_charmap (struct linereader *cmfile, int verbose, int be_quiet)
if (arg->tok != tok_number)
goto badarg;
- if (verbose
- && ((nowtok == tok_mb_cur_max
+ if ((nowtok == tok_mb_cur_max
&& result->mb_cur_max != 0)
|| (nowtok == tok_mb_cur_max
- && result->mb_cur_max != 0)))
+ && result->mb_cur_max != 0))
lr_error (cmfile, _("duplicate definition of <%s>"),
nowtok == tok_mb_cur_min
? "mb_cur_min" : "mb_cur_max");
@@ -839,16 +844,16 @@ only WIDTH definitions are allowed to follow the CHARMAP definition"));
continue;
default:
- WITH_CUR_LOCALE (error (5, 0, _("%s: error in state machine"),
- __FILE__));
+ record_error (5, 0, _("%s: error in state machine"),
+ __FILE__);
/* NOTREACHED */
}
break;
}
- if (state != 91 && !be_quiet)
- WITH_CUR_LOCALE (error (0, 0, _("%s: premature end of file"),
- cmfile->fname));
+ if (state != 91)
+ record_error (0, 0, _("%s: premature end of file"),
+ cmfile->fname);
lr_close (cmfile);
diff --git a/locale/programs/charmap.h b/locale/programs/charmap.h
index 9e7066f96c..66a4385eef 100644
--- a/locale/programs/charmap.h
+++ b/locale/programs/charmap.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2016 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
diff --git a/locale/programs/config.h b/locale/programs/config.h
index f606365f2a..9956cd8446 100644
--- a/locale/programs/config.h
+++ b/locale/programs/config.h
@@ -1,5 +1,5 @@
/* Configuration for localedef program.
- Copyright (C) 1995-2016 Free Software Foundation, Inc.
+ Copyright (C) 1995-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1995.
diff --git a/locale/programs/ld-address.c b/locale/programs/ld-address.c
index f13331941e..3972bb1969 100644
--- a/locale/programs/ld-address.c
+++ b/locale/programs/ld-address.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2016 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -20,7 +20,6 @@
#endif
#include <byteswap.h>
-#include <error.h>
#include <langinfo.h>
#include <string.h>
#include <stdint.h>
@@ -131,9 +130,8 @@ address_finish (struct localedef_t *locale, const struct charmap_t *charmap)
empty one. */
if (address == NULL)
{
- if (! be_quiet)
- WITH_CUR_LOCALE (error (0, 0, _("\
-No definition for %s category found"), "LC_ADDRESS"));
+ record_warning (_("\
+No definition for %s category found"), "LC_ADDRESS");
address_startup (NULL, locale, 0);
address = locale->categories[LC_ADDRESS].address;
nothing = 1;
@@ -143,20 +141,20 @@ No definition for %s category found"), "LC_ADDRESS"));
if (address->postal_fmt == NULL)
{
if (! nothing)
- WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"),
- "LC_ADDRESS", "postal_fmt"));
+ record_error (0, 0, _("%s: field `%s' not defined"),
+ "LC_ADDRESS", "postal_fmt");
/* Use as the default value the value of the i18n locale. */
address->postal_fmt = "%a%N%f%N%d%N%b%N%s %h %e %r%N%C-%z %T%N%c%N";
}
else
{
- /* We must check whether the format string contains only the
- allowed escape sequences. */
+ /* We must check whether the format string contains only the allowed
+ escape sequences. Last checked against ISO 30112 WD10 [2014]. */
const char *cp = address->postal_fmt;
if (*cp == '\0')
- WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' must not be empty"),
- "LC_ADDRESS", "postal_fmt"));
+ record_error (0, 0, _("%s: field `%s' must not be empty"),
+ "LC_ADDRESS", "postal_fmt");
else
while (*cp != '\0')
{
@@ -165,11 +163,11 @@ No definition for %s category found"), "LC_ADDRESS"));
if (*++cp == 'R')
/* Romanize-flag. */
++cp;
- if (strchr ("afdbshNtreCzTSc%", *cp) == NULL)
+ if (strchr ("nafdbshNtreClzTSc%", *cp) == NULL)
{
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
%s: invalid escape `%%%c' sequence in field `%s'"),
- "LC_ADDRESS", *cp, "postal_fmt"));
+ "LC_ADDRESS", *cp, "postal_fmt");
break;
}
}
@@ -181,8 +179,7 @@ No definition for %s category found"), "LC_ADDRESS"));
if (address->cat == NULL) \
{ \
if (verbose && ! nothing) \
- WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"), \
- "LC_ADDRESS", #cat)); \
+ record_warning (_("%s: field `%s' not defined"), "LC_ADDRESS", #cat); \
address->cat = ""; \
}
@@ -199,16 +196,16 @@ No definition for %s category found"), "LC_ADDRESS"));
if (address->lang_term == NULL)
{
if (verbose && ! nothing)
- WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"),
- "LC_ADDRESS", "lang_term"));
+ record_warning (_("%s: field `%s' not defined"), "LC_ADDRESS",
+ "lang_term");
address->lang_term = "";
cnt = sizeof (iso639) / sizeof (iso639[0]);
}
else if (address->lang_term[0] == '\0')
{
if (verbose)
- WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' must not be empty"),
- "LC_ADDRESS", "lang_term"));
+ record_warning (_("%s: field `%s' must not be empty"), "LC_ADDRESS",
+ "lang_term");
cnt = sizeof (iso639) / sizeof (iso639[0]);
}
else
@@ -218,9 +215,9 @@ No definition for %s category found"), "LC_ADDRESS"));
if (strcmp (address->lang_term, iso639[cnt].term) == 0)
break;
if (cnt == sizeof (iso639) / sizeof (iso639[0]))
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
%s: terminology language code `%s' not defined"),
- "LC_ADDRESS", address->lang_term));
+ "LC_ADDRESS", address->lang_term);
}
if (address->lang_ab == NULL)
@@ -228,8 +225,8 @@ No definition for %s category found"), "LC_ADDRESS"));
if ((cnt == sizeof (iso639) / sizeof (iso639[0])
|| iso639[cnt].ab[0] != '\0')
&& verbose && ! nothing)
- WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"),
- "LC_ADDRESS", "lang_ab"));
+ record_warning (_("%s: field `%s' not defined"), "LC_ADDRESS",
+ "lang_ab");
address->lang_ab = "";
}
else if (address->lang_ab[0] == '\0')
@@ -237,14 +234,14 @@ No definition for %s category found"), "LC_ADDRESS"));
if ((cnt == sizeof (iso639) / sizeof (iso639[0])
|| iso639[cnt].ab[0] != '\0')
&& verbose)
- WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' must not be empty"),
- "LC_ADDRESS", "lang_ab"));
+ record_warning (_("%s: field `%s' must not be empty"),
+ "LC_ADDRESS", "lang_ab");
}
else if (cnt < sizeof (iso639) / sizeof (iso639[0])
&& iso639[cnt].ab[0] == '\0')
{
- WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' must not be defined"),
- "LC_ADDRESS", "lang_ab"));
+ record_error (0, 0, _("%s: field `%s' must not be defined"),
+ "LC_ADDRESS", "lang_ab");
address->lang_ab = "";
}
@@ -257,16 +254,16 @@ No definition for %s category found"), "LC_ADDRESS"));
if (strcmp (address->lang_ab, iso639[cnt].ab) == 0)
break;
if (cnt == sizeof (iso639) / sizeof (iso639[0]))
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
%s: language abbreviation `%s' not defined"),
- "LC_ADDRESS", address->lang_ab));
+ "LC_ADDRESS", address->lang_ab);
}
else
if (strcmp (iso639[cnt].ab, address->lang_ab) != 0
&& iso639[cnt].ab[0] != '\0')
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
%s: `%s' value does not match `%s' value"),
- "LC_ADDRESS", "lang_ab", "lang_term"));
+ "LC_ADDRESS", "lang_ab", "lang_term");
}
if (address->lang_lib == NULL)
@@ -275,8 +272,8 @@ No definition for %s category found"), "LC_ADDRESS"));
else if (address->lang_lib[0] == '\0')
{
if (verbose)
- WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' must not be empty"),
- "LC_ADDRESS", "lang_lib"));
+ record_warning (_("%s: field `%s' must not be empty"),
+ "LC_ADDRESS", "lang_lib");
}
else
{
@@ -286,22 +283,22 @@ No definition for %s category found"), "LC_ADDRESS"));
if (strcmp (address->lang_lib, iso639[cnt].lib) == 0)
break;
if (cnt == sizeof (iso639) / sizeof (iso639[0]))
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
%s: language abbreviation `%s' not defined"),
- "LC_ADDRESS", address->lang_lib));
+ "LC_ADDRESS", address->lang_lib);
}
else
if (strcmp (iso639[cnt].ab, address->lang_ab) != 0)
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
%s: `%s' value does not match `%s' value"), "LC_ADDRESS", "lang_lib",
- helper == 1 ? "lang_term" : "lang_ab"));
+ helper == 1 ? "lang_term" : "lang_ab");
}
if (address->country_num == 0)
{
if (verbose && ! nothing)
- WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"),
- "LC_ADDRESS", "country_num"));
+ record_warning (_("%s: field `%s' not defined"), "LC_ADDRESS",
+ "country_num");
cnt = sizeof (iso3166) / sizeof (iso3166[0]);
}
else
@@ -311,36 +308,35 @@ No definition for %s category found"), "LC_ADDRESS"));
break;
if (cnt == sizeof (iso3166) / sizeof (iso3166[0]))
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
%s: numeric country code `%d' not valid"),
- "LC_ADDRESS", address->country_num));
+ "LC_ADDRESS", address->country_num);
}
if (address->country_ab2 == NULL)
{
if (verbose && ! nothing)
- WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"),
- "LC_ADDRESS", "country_ab2"));
+ record_warning (_("%s: field `%s' not defined"), "LC_ADDRESS",
+ "country_ab2");
address->country_ab2 = " ";
}
else if (cnt != sizeof (iso3166) / sizeof (iso3166[0])
&& strcmp (address->country_ab2, iso3166[cnt].ab2) != 0)
- WITH_CUR_LOCALE (error (0, 0,
- _("%s: `%s' value does not match `%s' value"),
- "LC_ADDRESS", "country_ab2", "country_num"));
+ record_error (0, 0, _("%s: `%s' value does not match `%s' value"),
+ "LC_ADDRESS", "country_ab2", "country_num");
if (address->country_ab3 == NULL)
{
if (verbose && ! nothing)
- WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"),
- "LC_ADDRESS", "country_ab3"));
+ record_warning (_("%s: field `%s' not defined"), "LC_ADDRESS",
+ "country_ab3");
address->country_ab3 = " ";
}
else if (cnt != sizeof (iso3166) / sizeof (iso3166[0])
&& strcmp (address->country_ab3, iso3166[cnt].ab3) != 0)
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
%s: `%s' value does not match `%s' value"),
- "LC_ADDRESS", "country_ab3", "country_num"));
+ "LC_ADDRESS", "country_ab3", "country_num");
}
@@ -485,8 +481,8 @@ address_read (struct linereader *ldfile, struct localedef_t *result,
address->cat = arg->val.str.startmb; \
else \
{ \
- char *numbuf = (char *) xmalloc (11); \
- snprintf (numbuf, 11, "%ld", arg->val.num); \
+ char *numbuf = (char *) xmalloc (21); \
+ snprintf (numbuf, 21, "%ld", arg->val.num); \
address->cat = numbuf; \
} \
} \
diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c
index 1e125f60fd..d2eebcfdbb 100644
--- a/locale/programs/ld-collate.c
+++ b/locale/programs/ld-collate.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2016 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1995.
@@ -20,7 +20,6 @@
#endif
#include <errno.h>
-#include <error.h>
#include <stdlib.h>
#include <wchar.h>
#include <stdint.h>
@@ -1560,10 +1559,9 @@ collate_finish (struct localedef_t *locale, const struct charmap_t *charmap)
if (collate == NULL)
{
- /* No data, no check. */
- if (! be_quiet)
- WITH_CUR_LOCALE (error (0, 0, _("No definition for %s category found"),
- "LC_COLLATE"));
+ /* No data, no check. Issue a warning. */
+ record_warning (_("No definition for %s category found"),
+ "LC_COLLATE");
return;
}
@@ -1579,9 +1577,9 @@ collate_finish (struct localedef_t *locale, const struct charmap_t *charmap)
&& ((sect->rules[i] & sort_position)
!= (collate->current_section->rules[i] & sort_position)))
{
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
%s: `position' must be used for a specific level in all sections or none"),
- "LC_COLLATE"));
+ "LC_COLLATE");
break;
}
@@ -1602,10 +1600,9 @@ collate_finish (struct localedef_t *locale, const struct charmap_t *charmap)
{
if (runp->weights[i].w[j]->weights == NULL)
{
- WITH_CUR_LOCALE (error_at_line (0, 0, runp->file,
- runp->line,
- _("symbol `%s' not defined"),
- runp->weights[i].w[j]->name));
+ record_error_at_line (0, 0, runp->file, runp->line,
+ _("symbol `%s' not defined"),
+ runp->weights[i].w[j]->name);
need_undefined = 1;
runp->weights[i].w[j] = &collate->undefined;
@@ -1678,14 +1675,13 @@ collate_finish (struct localedef_t *locale, const struct charmap_t *charmap)
/* This should not happen. It means that we have
to symbols with the same byte sequence. It is
of course an error. */
- WITH_CUR_LOCALE (error_at_line (0, 0, (*eptr)->file,
- (*eptr)->line,
- _("\
+ record_error_at_line (0, 0, (*eptr)->file,
+ (*eptr)->line,
+ _("\
symbol `%s' has the same encoding as"), (*eptr)->name);
- error_at_line (0, 0, runp->file,
- runp->line,
- _("symbol `%s'"),
- runp->name));
+
+ record_error_at_line (0, 0, runp->file, runp->line,
+ _("symbol `%s'"), runp->name);
goto dont_insert;
}
else if (c < 0)
@@ -1784,14 +1780,13 @@ symbol `%s' has the same encoding as"), (*eptr)->name);
/* This should not happen. It means that we have
two symbols with the same byte sequence. It is
of course an error. */
- WITH_CUR_LOCALE (error_at_line (0, 0, (*eptr)->file,
- (*eptr)->line,
- _("\
+ record_error_at_line (0, 0, (*eptr)->file,
+ (*eptr)->line,
+ _("\
symbol `%s' has the same encoding as"), (*eptr)->name);
- error_at_line (0, 0, runp->file,
- runp->line,
- _("symbol `%s'"),
- runp->name));
+
+ record_error_at_line (0, 0, runp->file, runp->line,
+ _("symbol `%s'"), runp->name);
goto dont_insertwc;
}
else if (c < 0)
@@ -1829,10 +1824,6 @@ symbol `%s' has the same encoding as"), (*eptr)->name);
{
/* This seems not to be enforced by recent standards. Don't
emit an error, simply append UNDEFINED at the end. */
- if (0)
- WITH_CUR_LOCALE (error (0, 0, _("no definition of `UNDEFINED'")));
-
- /* Add UNDEFINED at the end. */
collate->undefined.mborder =
(int *) obstack_alloc (&collate->mempool, nrules * sizeof (int));
@@ -1858,8 +1849,7 @@ symbol `%s' has the same encoding as"), (*eptr)->name);
/* Bail out if we have no sections because of earlier errors. */
if (sect == NULL)
{
- WITH_CUR_LOCALE (error (EXIT_FAILURE, 0,
- _("too many errors; giving up")));
+ record_error (EXIT_FAILURE, 0, _("too many errors; giving up"));
return;
}
@@ -3408,8 +3398,8 @@ error while adding equivalent collating symbol"));
}
else if (state == 3)
{
- WITH_CUR_LOCALE (error (0, 0, _("\
-%s: missing `reorder-end' keyword"), "LC_COLLATE"));
+ record_error (0, 0, _("\
+%s: missing `reorder-end' keyword"), "LC_COLLATE");
state = 4;
}
else if (state != 2 && state != 4)
@@ -3769,11 +3759,11 @@ error while adding equivalent collating symbol"));
}
}
else if (state == 3)
- WITH_CUR_LOCALE (error (0, 0, _("\
-%s: missing `reorder-end' keyword"), "LC_COLLATE"));
+ record_error (0, 0, _("\
+%s: missing `reorder-end' keyword"), "LC_COLLATE");
else if (state == 5)
- WITH_CUR_LOCALE (error (0, 0, _("\
-%s: missing `reorder-sections-end' keyword"), "LC_COLLATE"));
+ record_error (0, 0, _("\
+%s: missing `reorder-sections-end' keyword"), "LC_COLLATE");
}
arg = lr_token (ldfile, charmap, result, NULL, verbose);
if (arg->tok == tok_eof)
diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c
index 0fd141ca7e..f791e6b7e9 100644
--- a/locale/programs/ld-ctype.c
+++ b/locale/programs/ld-ctype.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2016 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1995.
@@ -427,9 +427,8 @@ ctype_finish (struct localedef_t *locale, const struct charmap_t *charmap)
empty one. */
if (ctype == NULL)
{
- if (! be_quiet)
- WITH_CUR_LOCALE (error (0, 0, _("\
-No definition for %s category found"), "LC_CTYPE"));
+ record_warning (_("\
+No definition for %s category found"), "LC_CTYPE");
ctype_startup (NULL, locale, charmap, NULL, 0);
ctype = locale->categories[LC_CTYPE].ctype;
}
@@ -446,9 +445,8 @@ No definition for %s category found"), "LC_CTYPE"));
ctype->codeset_name = charmap->code_set_name;
if (ctype->codeset_name == NULL)
{
- if (! be_quiet)
- WITH_CUR_LOCALE (error (0, 0, _("\
-No character set name specified in charmap")));
+ record_error (0, 0, _("\
+No character set name specified in charmap"));
ctype->codeset_name = "//UNKNOWN//";
}
@@ -475,13 +473,12 @@ No character set name specified in charmap")));
{
uint32_t value = ctype->charnames[cnt];
- if (!be_quiet)
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
character L'\\u%0*x' in class `%s' must be in class `%s'"),
- value > 0xffff ? 8 : 4,
- value,
- valid_table[cls1].name,
- valid_table[cls2].name));
+ value > 0xffff ? 8 : 4,
+ value,
+ valid_table[cls1].name,
+ valid_table[cls2].name);
}
break;
@@ -490,13 +487,12 @@ character L'\\u%0*x' in class `%s' must be in class `%s'"),
{
uint32_t value = ctype->charnames[cnt];
- if (!be_quiet)
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
character L'\\u%0*x' in class `%s' must not be in class `%s'"),
- value > 0xffff ? 8 : 4,
- value,
- valid_table[cls1].name,
- valid_table[cls2].name));
+ value > 0xffff ? 8 : 4,
+ value,
+ valid_table[cls1].name,
+ valid_table[cls2].name);
}
break;
@@ -505,8 +501,8 @@ character L'\\u%0*x' in class `%s' must not be in class `%s'"),
break;
default:
- WITH_CUR_LOCALE (error (5, 0, _("\
-internal error in %s, line %u"), __FUNCTION__, __LINE__));
+ record_error (5, 0, _("\
+internal error in %s, line %u"), __FUNCTION__, __LINE__);
}
}
}
@@ -533,12 +529,11 @@ internal error in %s, line %u"), __FUNCTION__, __LINE__));
snprintf (buf, sizeof buf, "\\%Zo", cnt);
- if (!be_quiet)
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
character '%s' in class `%s' must be in class `%s'"),
- buf,
- valid_table[cls1].name,
- valid_table[cls2].name));
+ buf,
+ valid_table[cls1].name,
+ valid_table[cls2].name);
}
break;
@@ -549,12 +544,11 @@ character '%s' in class `%s' must be in class `%s'"),
snprintf (buf, sizeof buf, "\\%Zo", cnt);
- if (!be_quiet)
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
character '%s' in class `%s' must not be in class `%s'"),
- buf,
- valid_table[cls1].name,
- valid_table[cls2].name));
+ buf,
+ valid_table[cls1].name,
+ valid_table[cls2].name);
}
break;
@@ -563,8 +557,8 @@ character '%s' in class `%s' must not be in class `%s'"),
break;
default:
- WITH_CUR_LOCALE (error (5, 0, _("\
-internal error in %s, line %u"), __FUNCTION__, __LINE__));
+ record_error (5, 0, _("\
+internal error in %s, line %u"), __FUNCTION__, __LINE__);
}
}
}
@@ -579,9 +573,8 @@ internal error in %s, line %u"), __FUNCTION__, __LINE__));
(ELEM (ctype, class_collection, , space_value)
& BITw (tok_blank)) == 0)))
{
- if (!be_quiet)
- WITH_CUR_LOCALE (error (0, 0, _("<SP> character not in class `%s'"),
- valid_table[cnt].name));
+ record_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)
@@ -591,10 +584,9 @@ internal error in %s, line %u"), __FUNCTION__, __LINE__));
& BITw (tok_graph))
!= 0)))
{
- if (!be_quiet)
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
<SP> character must not be in class `%s'"),
- valid_table[cnt].name));
+ valid_table[cnt].name);
}
else
ELEM (ctype, class_collection, , space_value) |= BITw (tok_print);
@@ -606,9 +598,8 @@ internal error in %s, line %u"), __FUNCTION__, __LINE__));
space_seq = charmap_find_value (charmap, "U00000020", 9);
if (space_seq == NULL || space_seq->nbytes != 1)
{
- if (!be_quiet)
- WITH_CUR_LOCALE (error (0, 0, _("\
-character <SP> not defined in character map")));
+ record_error (0, 0, _("\
+character <SP> not defined in character map"));
}
else if (((cnt = BITPOS (tok_space),
(ctype->class256_collection[space_seq->bytes[0]]
@@ -617,9 +608,8 @@ character <SP> not defined in character map")));
(ctype->class256_collection[space_seq->bytes[0]]
& BIT (tok_blank)) == 0)))
{
- if (!be_quiet)
- WITH_CUR_LOCALE (error (0, 0, _("<SP> character not in class `%s'"),
- valid_table[cnt].name));
+ record_error (0, 0, _("<SP> character not in class `%s'"),
+ valid_table[cnt].name);
}
else if (((cnt = BITPOS (tok_punct),
(ctype->class256_collection[space_seq->bytes[0]]
@@ -628,10 +618,9 @@ character <SP> not defined in character map")));
(ctype->class256_collection[space_seq->bytes[0]]
& BIT (tok_graph)) != 0)))
{
- if (!be_quiet)
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
<SP> character must not be in class `%s'"),
- valid_table[cnt].name));
+ valid_table[cnt].name);
}
else
ctype->class256_collection[space_seq->bytes[0]] |= BIT (tok_print);
@@ -743,8 +732,8 @@ character <SP> not defined in character map")));
assert (ctype->mbdigits_act == ctype->wcdigits_act);
ctype->wcdigits_act -= ctype->mbdigits_act % 10;
ctype->mbdigits_act -= ctype->mbdigits_act % 10;
- WITH_CUR_LOCALE (error (0, 0, _("\
-`digit' category has not entries in groups of ten")));
+ record_error (0, 0, _("\
+`digit' category has not entries in groups of ten"));
}
/* Check the input digits. There must be a multiple of ten available.
@@ -792,8 +781,8 @@ character <SP> not defined in character map")));
if (ctype->mbdigits[cnt] == NULL)
{
/* Hum, this ain't good. */
- WITH_CUR_LOCALE (error (0, 0, _("\
-no input digits defined and none of the standard names in the charmap")));
+ record_error (0, 0, _("\
+no input digits defined and none of the standard names in the charmap"));
ctype->mbdigits[cnt] = obstack_alloc (&((struct charmap_t *) charmap)->mem_pool,
sizeof (struct charseq) + 1);
@@ -857,8 +846,8 @@ no input digits defined and none of the standard names in the charmap")));
if (!warned)
{
- WITH_CUR_LOCALE (error (0, 0, _("\
-not all characters used in `outdigit' are available in the charmap")));
+ record_error (0, 0, _("\
+not all characters used in `outdigit' are available in the charmap"));
warned = 1;
}
@@ -874,8 +863,8 @@ not all characters used in `outdigit' are available in the charmap")));
{
if (!warned)
{
- WITH_CUR_LOCALE (error (0, 0, _("\
-not all characters used in `outdigit' are available in the repertoire")));
+ record_error (0, 0, _("\
+not all characters used in `outdigit' are available in the repertoire"));
warned = 1;
}
@@ -1145,9 +1134,9 @@ ctype_class_new (struct linereader *lr, struct locale_ctype_t *ctype,
if (ctype->nr_charclass == MAX_NR_CHARCLASS)
/* Exit code 2 is prescribed in P1003.2b. */
- WITH_CUR_LOCALE (error (2, 0, _("\
+ record_error (2, 0, _("\
implementation limit: no more than %Zd character classes allowed"),
- MAX_NR_CHARCLASS));
+ MAX_NR_CHARCLASS);
ctype->classnames[ctype->nr_charclass++] = name;
}
@@ -1177,9 +1166,9 @@ ctype_map_new (struct linereader *lr, struct locale_ctype_t *ctype,
if (ctype->map_collection_nr == MAX_NR_CHARMAP)
/* Exit code 2 is prescribed in P1003.2b. */
- WITH_CUR_LOCALE (error (2, 0, _("\
+ record_error (2, 0, _("\
implementation limit: no more than %d character maps allowed"),
- MAX_NR_CHARMAP));
+ MAX_NR_CHARMAP);
ctype->mapnames[cnt] = name;
@@ -2743,11 +2732,11 @@ with character code range values one must use the absolute ellipsis `...'"));
{
lr_error (ldfile, _("\
%s: duplicate `default_missing' definition"), "LC_CTYPE");
- WITH_CUR_LOCALE (error_at_line (0, 0,
- ctype->default_missing_file,
- ctype->default_missing_lineno,
- _("\
-previous definition was here")));
+ record_error_at_line (0, 0,
+ ctype->default_missing_file,
+ ctype->default_missing_lineno,
+ _("\
+previous definition was here"));
}
else
{
@@ -2885,15 +2874,14 @@ set_one_default (struct locale_ctype_t *ctype,
}
if (seq == NULL)
{
- if (!be_quiet)
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
%s: character `%s' not defined while needed as default value"),
- "LC_CTYPE", tmp));
+ "LC_CTYPE", tmp);
}
else if (seq->nbytes != 1)
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
%s: character `%s' in charmap not representable with one byte"),
- "LC_CTYPE", tmp));
+ "LC_CTYPE", tmp);
else
ctype->class256_collection[seq->bytes[0]] |= bit;
@@ -2982,15 +2970,14 @@ set_class_defaults (struct locale_ctype_t *ctype,
seq = charmap_find_value (charmap, "U00000020", 9);
if (seq == NULL)
{
- if (!be_quiet)
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
%s: character `%s' not defined while needed as default value"),
- "LC_CTYPE", "<space>"));
+ "LC_CTYPE", "<space>");
}
else if (seq->nbytes != 1)
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
%s: character `%s' in charmap not representable with one byte"),
- "LC_CTYPE", "<space>"));
+ "LC_CTYPE", "<space>");
else
ctype->class256_collection[seq->bytes[0]] |= BIT (tok_space);
@@ -3002,15 +2989,14 @@ set_class_defaults (struct locale_ctype_t *ctype,
seq = charmap_find_value (charmap, "U0000000C", 9);
if (seq == NULL)
{
- if (!be_quiet)
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
%s: character `%s' not defined while needed as default value"),
- "LC_CTYPE", "<form-feed>"));
+ "LC_CTYPE", "<form-feed>");
}
else if (seq->nbytes != 1)
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
%s: character `%s' in charmap not representable with one byte"),
- "LC_CTYPE", "<form-feed>"));
+ "LC_CTYPE", "<form-feed>");
else
ctype->class256_collection[seq->bytes[0]] |= BIT (tok_space);
@@ -3023,15 +3009,14 @@ set_class_defaults (struct locale_ctype_t *ctype,
seq = charmap_find_value (charmap, "U0000000A", 9);
if (seq == NULL)
{
- if (!be_quiet)
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
%s: character `%s' not defined while needed as default value"),
- "LC_CTYPE", "<newline>"));
+ "LC_CTYPE", "<newline>");
}
else if (seq->nbytes != 1)
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
%s: character `%s' in charmap not representable with one byte"),
- "LC_CTYPE", "<newline>"));
+ "LC_CTYPE", "<newline>");
else
ctype->class256_collection[seq->bytes[0]] |= BIT (tok_space);
@@ -3044,15 +3029,14 @@ set_class_defaults (struct locale_ctype_t *ctype,
seq = charmap_find_value (charmap, "U0000000D", 9);
if (seq == NULL)
{
- if (!be_quiet)
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
%s: character `%s' not defined while needed as default value"),
- "LC_CTYPE", "<carriage-return>"));
+ "LC_CTYPE", "<carriage-return>");
}
else if (seq->nbytes != 1)
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
%s: character `%s' in charmap not representable with one byte"),
- "LC_CTYPE", "<carriage-return>"));
+ "LC_CTYPE", "<carriage-return>");
else
ctype->class256_collection[seq->bytes[0]] |= BIT (tok_space);
@@ -3065,15 +3049,14 @@ set_class_defaults (struct locale_ctype_t *ctype,
seq = charmap_find_value (charmap, "U00000009", 9);
if (seq == NULL)
{
- if (!be_quiet)
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
%s: character `%s' not defined while needed as default value"),
- "LC_CTYPE", "<tab>"));
+ "LC_CTYPE", "<tab>");
}
else if (seq->nbytes != 1)
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
%s: character `%s' in charmap not representable with one byte"),
- "LC_CTYPE", "<tab>"));
+ "LC_CTYPE", "<tab>");
else
ctype->class256_collection[seq->bytes[0]] |= BIT (tok_space);
@@ -3086,15 +3069,14 @@ set_class_defaults (struct locale_ctype_t *ctype,
seq = charmap_find_value (charmap, "U0000000B", 9);
if (seq == NULL)
{
- if (!be_quiet)
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
%s: character `%s' not defined while needed as default value"),
- "LC_CTYPE", "<vertical-tab>"));
+ "LC_CTYPE", "<vertical-tab>");
}
else if (seq->nbytes != 1)
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
%s: character `%s' in charmap not representable with one byte"),
- "LC_CTYPE", "<vertical-tab>"));
+ "LC_CTYPE", "<vertical-tab>");
else
ctype->class256_collection[seq->bytes[0]] |= BIT (tok_space);
@@ -3126,15 +3108,14 @@ set_class_defaults (struct locale_ctype_t *ctype,
seq = charmap_find_value (charmap, "U00000020", 9);
if (seq == NULL)
{
- if (!be_quiet)
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
%s: character `%s' not defined while needed as default value"),
- "LC_CTYPE", "<space>"));
+ "LC_CTYPE", "<space>");
}
else if (seq->nbytes != 1)
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
%s: character `%s' in charmap not representable with one byte"),
- "LC_CTYPE", "<space>"));
+ "LC_CTYPE", "<space>");
else
ctype->class256_collection[seq->bytes[0]] |= BIT (tok_blank);
@@ -3147,15 +3128,14 @@ set_class_defaults (struct locale_ctype_t *ctype,
seq = charmap_find_value (charmap, "U00000009", 9);
if (seq == NULL)
{
- if (!be_quiet)
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
%s: character `%s' not defined while needed as default value"),
- "LC_CTYPE", "<tab>"));
+ "LC_CTYPE", "<tab>");
}
else if (seq->nbytes != 1)
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
%s: character `%s' in charmap not representable with one byte"),
- "LC_CTYPE", "<tab>"));
+ "LC_CTYPE", "<tab>");
else
ctype->class256_collection[seq->bytes[0]] |= BIT (tok_blank);
@@ -3212,15 +3192,14 @@ set_class_defaults (struct locale_ctype_t *ctype,
seq = charmap_find_value (charmap, "U00000020", 9);
if (seq == NULL)
{
- if (!be_quiet)
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
%s: character `%s' not defined while needed as default value"),
- "LC_CTYPE", "<space>"));
+ "LC_CTYPE", "<space>");
}
else if (seq->nbytes != 1)
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
%s: character `%s' in charmap not representable with one byte"),
- "LC_CTYPE", "<space>"));
+ "LC_CTYPE", "<space>");
else
ctype->class256_collection[seq->bytes[0]] |= BIT (tok_print);
@@ -3254,17 +3233,15 @@ set_class_defaults (struct locale_ctype_t *ctype,
}
if (seq_from == NULL)
{
- if (!be_quiet)
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
%s: character `%s' not defined while needed as default value"),
- "LC_CTYPE", tmp));
+ "LC_CTYPE", tmp);
}
else if (seq_from->nbytes != 1)
{
- if (!be_quiet)
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
%s: character `%s' needed as default value not representable with one byte"),
- "LC_CTYPE", tmp));
+ "LC_CTYPE", tmp);
}
else
{
@@ -3279,17 +3256,15 @@ set_class_defaults (struct locale_ctype_t *ctype,
}
if (seq_to == NULL)
{
- if (!be_quiet)
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
%s: character `%s' not defined while needed as default value"),
- "LC_CTYPE", tmp));
+ "LC_CTYPE", tmp);
}
else if (seq_to->nbytes != 1)
{
- if (!be_quiet)
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
%s: character `%s' needed as default value not representable with one byte"),
- "LC_CTYPE", tmp));
+ "LC_CTYPE", tmp);
}
else
/* The index [0] is determined by the order of the
@@ -3321,9 +3296,9 @@ set_class_defaults (struct locale_ctype_t *ctype,
if (ctype->outdigits_act != 10)
{
if (ctype->outdigits_act != 0)
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
%s: field `%s' does not contain exactly ten entries"),
- "LC_CTYPE", "outdigit"));
+ "LC_CTYPE", "outdigit");
for (size_t cnt = ctype->outdigits_act; cnt < 10; ++cnt)
{
@@ -3343,8 +3318,8 @@ set_class_defaults (struct locale_ctype_t *ctype,
if (ctype->mboutdigits[cnt] == NULL)
{
/* Provide a replacement. */
- WITH_CUR_LOCALE (error (0, 0, _("\
-no output digits defined and none of the standard names in the charmap")));
+ record_error (0, 0, _("\
+no output digits defined and none of the standard names in the charmap"));
ctype->mboutdigits[cnt] = obstack_alloc (&((struct charmap_t *) charmap)->mem_pool,
sizeof (struct charseq)
@@ -3592,9 +3567,9 @@ translit_flatten (struct locale_ctype_t *ctype,
if (other == NULL || other->categories[LC_CTYPE].ctype == NULL)
{
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
%s: transliteration data from locale `%s' not available"),
- "LC_CTYPE", copy_locale));
+ "LC_CTYPE", copy_locale);
}
else
{
@@ -3691,11 +3666,10 @@ allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap,
if (ctype->class_collection[idx] & _ISwbit (nr))
wctype_table_add (t, ctype->charnames[idx]);
- if (verbose)
- WITH_CUR_LOCALE (fprintf (stderr, _("\
-%s: table for class \"%s\": %lu bytes\n"),
- "LC_CTYPE", ctype->classnames[nr],
- (unsigned long int) t->result_size));
+ record_verbose (stderr, _("\
+%s: table for class \"%s\": %lu bytes"),
+ "LC_CTYPE", ctype->classnames[nr],
+ (unsigned long int) t->result_size);
}
/* Room for table of mappings. */
@@ -3756,11 +3730,10 @@ allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap,
wctrans_table_add (t, ctype->charnames[idx],
ctype->map_collection[nr][idx]);
- if (verbose)
- WITH_CUR_LOCALE (fprintf (stderr, _("\
-%s: table for map \"%s\": %lu bytes\n"),
- "LC_CTYPE", ctype->mapnames[nr],
- (unsigned long int) t->result_size));
+ record_verbose (stderr, _("\
+%s: table for map \"%s\": %lu bytes"),
+ "LC_CTYPE", ctype->mapnames[nr],
+ (unsigned long int) t->result_size);
}
/* Extra array for class and map names. */
@@ -3881,9 +3854,8 @@ allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap,
/* Set the width of L'\0' to 0. */
wcwidth_table_add (t, 0, 0);
- if (verbose)
- WITH_CUR_LOCALE (fprintf (stderr, _("%s: table for width: %lu bytes\n"),
- "LC_CTYPE", (unsigned long int) t->result_size));
+ record_verbose (stderr, _("%s: table for width: %lu bytes"),
+ "LC_CTYPE", (unsigned long int) t->result_size);
}
/* Set MB_CUR_MAX. */
diff --git a/locale/programs/ld-identification.c b/locale/programs/ld-identification.c
index 1e8fa84712..df0257b6c0 100644
--- a/locale/programs/ld-identification.c
+++ b/locale/programs/ld-identification.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2016 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -19,7 +19,6 @@
# include <config.h>
#endif
-#include <error.h>
#include <langinfo.h>
#include <stdlib.h>
#include <string.h>
@@ -129,9 +128,8 @@ identification_finish (struct localedef_t *locale,
empty one. */
if (identification == NULL)
{
- if (! be_quiet)
- WITH_CUR_LOCALE (error (0, 0, _("\
-No definition for %s category found"), "LC_IDENTIFICATION"));
+ record_warning (_("\
+No definition for %s category found"), "LC_IDENTIFICATION");
identification_startup (NULL, locale, 0);
identification
= locale->categories[LC_IDENTIFICATION].identification;
@@ -143,8 +141,8 @@ No definition for %s category found"), "LC_IDENTIFICATION"));
if (identification->cat == NULL) \
{ \
if (verbose && ! nothing) \
- WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"), \
- "LC_IDENTIFICATION", #cat)); \
+ record_warning (_("%s: field `%s' not defined"), "LC_IDENTIFICATION", \
+ #cat); \
identification->cat = ""; \
}
@@ -164,14 +162,45 @@ No definition for %s category found"), "LC_IDENTIFICATION"));
TEST_ELEM (date);
for (num = 0; num < __LC_LAST; ++num)
- if (num != LC_ALL && identification->category[num] == NULL)
- {
- if (verbose && ! nothing)
- WITH_CUR_LOCALE (error (0, 0, _("\
-%s: no identification for category `%s'"),
- "LC_IDENTIFICATION", category_name[num]));
- identification->category[num] = "";
- }
+ {
+ /* We don't accept/parse this category, so skip it early. */
+ if (num == LC_ALL)
+ continue;
+
+ if (identification->category[num] == NULL)
+ {
+ if (verbose && ! nothing)
+ record_warning (_("\
+%s: no identification for category `%s'"), "LC_IDENTIFICATION",
+ category_name[num]);
+ identification->category[num] = "";
+ }
+ else
+ {
+ /* Only list the standards we care about. This is based on the
+ ISO 30112 WD10 [2014] standard which supersedes all previous
+ revisions of the ISO 14652 standard. */
+ static const char * const standards[] =
+ {
+ "posix:1993",
+ "i18n:2004",
+ "i18n:2012",
+ };
+ size_t i;
+ bool matched = false;
+
+ for (i = 0; i < sizeof (standards) / sizeof (standards[0]); ++i)
+ if (strcmp (identification->category[num], standards[i]) == 0)
+ matched = true;
+
+ if (matched != true)
+ record_error (0, 0, _("\
+%s: unknown standard `%s' for category `%s'"),
+ "LC_IDENTIFICATION",
+ identification->category[num],
+ category_name[num]);
+ }
+ }
}
diff --git a/locale/programs/ld-measurement.c b/locale/programs/ld-measurement.c
index c4f98111e3..4d76c716f4 100644
--- a/locale/programs/ld-measurement.c
+++ b/locale/programs/ld-measurement.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2016 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -19,7 +19,6 @@
# include <config.h>
#endif
-#include <error.h>
#include <langinfo.h>
#include <string.h>
#include <stdint.h>
@@ -90,9 +89,8 @@ measurement_finish (struct localedef_t *locale,
empty one. */
if (measurement == NULL)
{
- if (! be_quiet)
- WITH_CUR_LOCALE (error (0, 0, _("\
-No definition for %s category found"), "LC_MEASUREMENT"));
+ record_warning (_("\
+No definition for %s category found"), "LC_MEASUREMENT");
measurement_startup (NULL, locale, 0);
measurement = locale->categories[LC_MEASUREMENT].measurement;
nothing = 1;
@@ -102,16 +100,16 @@ No definition for %s category found"), "LC_MEASUREMENT"));
if (measurement->measurement == 0)
{
if (! nothing)
- WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"),
- "LC_MEASUREMENT", "measurement"));
+ record_error (0, 0, _("%s: field `%s' not defined"),
+ "LC_MEASUREMENT", "measurement");
/* Use as the default value the value of the i18n locale. */
measurement->measurement = 1;
}
else
{
if (measurement->measurement > 3)
- WITH_CUR_LOCALE (error (0, 0, _("%s: invalid value for field `%s'"),
- "LC_MEASUREMENT", "measurement"));
+ record_error (0, 0, _("%s: invalid value for field `%s'"),
+ "LC_MEASUREMENT", "measurement");
}
}
diff --git a/locale/programs/ld-messages.c b/locale/programs/ld-messages.c
index 702190dad1..6e15571a0c 100644
--- a/locale/programs/ld-messages.c
+++ b/locale/programs/ld-messages.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2016 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1995.
@@ -93,9 +93,8 @@ messages_finish (struct localedef_t *locale, const struct charmap_t *charmap)
empty one. */
if (messages == NULL)
{
- if (! be_quiet)
- WITH_CUR_LOCALE (error (0, 0, _("\
-No definition for %s category found"), "LC_MESSAGES"));
+ record_warning (_("\
+No definition for %s category found"), "LC_MESSAGES");
messages_startup (NULL, locale, 0);
messages = locale->categories[LC_MESSAGES].messages;
nothing = 1;
@@ -110,17 +109,16 @@ No definition for %s category found"), "LC_MESSAGES"));
if (messages->yesexpr == NULL)
{
- if (! be_quiet && ! nothing)
- WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' undefined"),
- "LC_MESSAGES", "yesexpr"));
+ if (! nothing)
+ record_error (0, 0, _("%s: field `%s' undefined"),
+ "LC_MESSAGES", "yesexpr");
messages->yesexpr = "^[yY]";
}
else if (messages->yesexpr[0] == '\0')
{
- if (!be_quiet)
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
%s: value for field `%s' must not be an empty string"),
- "LC_MESSAGES", "yesexpr"));
+ "LC_MESSAGES", "yesexpr");
}
else
{
@@ -134,9 +132,9 @@ No definition for %s category found"), "LC_MESSAGES"));
char errbuf[BUFSIZ];
(void) regerror (result, &re, errbuf, BUFSIZ);
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
%s: no correct regular expression for field `%s': %s"),
- "LC_MESSAGES", "yesexpr", errbuf));
+ "LC_MESSAGES", "yesexpr", errbuf);
}
else if (result != 0)
regfree (&re);
@@ -144,17 +142,16 @@ No definition for %s category found"), "LC_MESSAGES"));
if (messages->noexpr == NULL)
{
- if (! be_quiet && ! nothing)
- WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' undefined"),
- "LC_MESSAGES", "noexpr"));
+ if (! nothing)
+ record_error (0, 0, _("%s: field `%s' undefined"),
+ "LC_MESSAGES", "noexpr");
messages->noexpr = "^[nN]";
}
else if (messages->noexpr[0] == '\0')
{
- if (!be_quiet)
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
%s: value for field `%s' must not be an empty string"),
- "LC_MESSAGES", "noexpr"));
+ "LC_MESSAGES", "noexpr");
}
else
{
@@ -168,9 +165,9 @@ No definition for %s category found"), "LC_MESSAGES"));
char errbuf[BUFSIZ];
(void) regerror (result, &re, errbuf, BUFSIZ);
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
%s: no correct regular expression for field `%s': %s"),
- "LC_MESSAGES", "noexpr", errbuf));
+ "LC_MESSAGES", "noexpr", errbuf);
}
else if (result != 0)
regfree (&re);
diff --git a/locale/programs/ld-monetary.c b/locale/programs/ld-monetary.c
index 8635d4fe5d..f927534032 100644
--- a/locale/programs/ld-monetary.c
+++ b/locale/programs/ld-monetary.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2016 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1995.
@@ -185,13 +185,12 @@ monetary_finish (struct localedef_t *locale, const struct charmap_t *charmap)
= from->categories[LC_MONETARY].monetary;
}
- /* If there is still no definition issue an warning and create an
+ /* If there is still no definition issue a warning and create an
empty one. */
if (monetary == NULL)
{
- if (! be_quiet)
- WITH_CUR_LOCALE (error (0, 0, _("\
-No definition for %s category found"), "LC_MONETARY"));
+ record_warning (_("\
+No definition for %s category found"), "LC_MONETARY");
monetary_startup (NULL, locale, 0);
monetary = locale->categories[LC_MONETARY].monetary;
nothing = 1;
@@ -201,9 +200,9 @@ No definition for %s category found"), "LC_MONETARY"));
#define TEST_ELEM(cat, initval) \
if (monetary->cat == NULL) \
{ \
- if (! be_quiet && ! nothing) \
- WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"), \
- "LC_MONETARY", #cat)); \
+ if (! nothing) \
+ record_error (0, 0, _("%s: field `%s' not defined"), \
+ "LC_MONETARY", #cat); \
monetary->cat = initval; \
}
@@ -217,26 +216,36 @@ No definition for %s category found"), "LC_MONETARY"));
/* The international currency symbol must come from ISO 4217. */
if (monetary->int_curr_symbol != NULL)
{
- if (strlen (monetary->int_curr_symbol) != 4)
+ /* POSIX says this should be a 3-character symbol from ISO 4217
+ along with a 4th character that is a divider, but the POSIX
+ locale is documented as having a special case of "", and we
+ support that also, so allow other locales to be created with
+ a blank int_curr_symbol. */
+ int ics_len = strlen (monetary->int_curr_symbol);
+ if (ics_len != 4 && ics_len != 0)
{
- if (! be_quiet && ! nothing)
- WITH_CUR_LOCALE (error (0, 0, _("\
+ if (! nothing)
+ record_error (0, 0, _("\
%s: value of field `int_curr_symbol' has wrong length"),
- "LC_MONETARY"));
+ "LC_MONETARY");
}
- else
+ else if (ics_len == 4)
{ /* Check the first three characters against ISO 4217 */
char symbol[4];
strncpy (symbol, monetary->int_curr_symbol, 3);
symbol[3] = '\0';
+ /* A user may disable this waning for testing purposes or
+ for building a locale with a 3 letter country code that
+ was not yet supported in our ISO 4217 list.
+ See the use of --no-warnings=intcurrsym. */
if (bsearch (symbol, valid_int_curr, NR_VALID_INT_CURR,
sizeof (const char *),
(comparison_fn_t) curr_strcmp) == NULL
- && !be_quiet)
- WITH_CUR_LOCALE (error (0, 0, _("\
+ && warn_int_curr_symbol)
+ record_warning (_("\
%s: value of field `int_curr_symbol' does \
-not correspond to a valid name in ISO 4217"),
- "LC_MONETARY"));
+not correspond to a valid name in ISO 4217 [--no-warnings=intcurrsym]"),
+ "LC_MONETARY");
}
}
@@ -245,25 +254,25 @@ not correspond to a valid name in ISO 4217"),
!= "". */
if (monetary->mon_decimal_point == NULL)
{
- if (! be_quiet && ! nothing)
- WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"),
- "LC_MONETARY", "mon_decimal_point"));
+ if (! nothing)
+ record_error (0, 0, _("%s: field `%s' not defined"),
+ "LC_MONETARY", "mon_decimal_point");
monetary->mon_decimal_point = ".";
}
else if (monetary->mon_decimal_point[0] == '\0' && ! be_quiet && ! nothing)
{
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
%s: value for field `%s' must not be an empty string"),
- "LC_MONETARY", "mon_decimal_point"));
+ "LC_MONETARY", "mon_decimal_point");
}
if (monetary->mon_decimal_point_wc == L'\0')
monetary->mon_decimal_point_wc = L'.';
if (monetary->mon_grouping_len == 0)
{
- if (! be_quiet && ! nothing)
- WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"),
- "LC_MONETARY", "mon_grouping"));
+ if (! nothing)
+ record_error (0, 0, _("%s: field `%s' not defined"),
+ "LC_MONETARY", "mon_grouping");
monetary->mon_grouping = (char *) "\177";
monetary->mon_grouping_len = 1;
@@ -273,17 +282,17 @@ not correspond to a valid name in ISO 4217"),
#define TEST_ELEM(cat, min, max, initval) \
if (monetary->cat == -2) \
{ \
- if (! be_quiet && ! nothing) \
- WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"), \
- "LC_MONETARY", #cat)); \
+ if (! nothing) \
+ record_error (0, 0, _("%s: field `%s' not defined"), \
+ "LC_MONETARY", #cat); \
monetary->cat = initval; \
} \
else if ((monetary->cat < min || monetary->cat > max) \
&& min < max \
&& !be_quiet && !nothing) \
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
%s: value for field `%s' must be in range %d...%d"), \
- "LC_MONETARY", #cat, min, max))
+ "LC_MONETARY", #cat, min, max)
TEST_ELEM (int_frac_digits, 1, 0, -1);
TEST_ELEM (frac_digits, 1, 0, -1);
@@ -309,11 +318,10 @@ not correspond to a valid name in ISO 4217"),
#define TEST_ELEM(cat, alt, min, max) \
if (monetary->cat == -2) \
monetary->cat = monetary->alt; \
- else if ((monetary->cat < min || monetary->cat > max) && !be_quiet \
- && ! nothing) \
- WITH_CUR_LOCALE (error (0, 0, _("\
+ else if ((monetary->cat < min || monetary->cat > max) && ! nothing) \
+ record_error (0, 0, _("\
%s: value for field `%s' must be in range %d...%d"), \
- "LC_MONETARY", #cat, min, max))
+ "LC_MONETARY", #cat, min, max)
TEST_ELEM (int_p_cs_precedes, p_cs_precedes, -1, 1);
TEST_ELEM (int_p_sep_by_space, p_sep_by_space, -1, 2);
diff --git a/locale/programs/ld-name.c b/locale/programs/ld-name.c
index b43bcc1c23..21e2d0123d 100644
--- a/locale/programs/ld-name.c
+++ b/locale/programs/ld-name.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2016 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -90,9 +90,8 @@ name_finish (struct localedef_t *locale, const struct charmap_t *charmap)
empty one. */
if (name == NULL)
{
- if (! be_quiet)
- WITH_CUR_LOCALE (error (0, 0, _("\
-No definition for %s category found"), "LC_NAME"));
+ record_warning (_("\
+No definition for %s category found"), "LC_NAME");
name_startup (NULL, locale, 0);
name = locale->categories[LC_NAME].name;
nothing = 1;
@@ -102,8 +101,8 @@ No definition for %s category found"), "LC_NAME"));
if (name->name_fmt == NULL)
{
if (! nothing)
- WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"),
- "LC_NAME", "name_fmt"));
+ record_error (0, 0, _("%s: field `%s' not defined"),
+ "LC_NAME", "name_fmt");
/* Use as the default value the value of the i18n locale. */
name->name_fmt = "%p%t%g%t%m%t%f";
}
@@ -114,8 +113,8 @@ No definition for %s category found"), "LC_NAME"));
const char *cp = name->name_fmt;
if (*cp == '\0')
- WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' must not be empty"),
- "LC_NAME", "name_fmt"));
+ record_error (0, 0, _("%s: field `%s' must not be empty"),
+ "LC_NAME", "name_fmt");
else
while (*cp != '\0')
{
@@ -126,8 +125,8 @@ No definition for %s category found"), "LC_NAME"));
++cp;
if (strchr ("dfFgGlomMpsSt", *cp) == NULL)
{
- WITH_CUR_LOCALE (error (0, 0, _("\
-%s: invalid escape sequence in field `%s'"), "LC_NAME", "name_fmt"));
+ record_error (0, 0, _("\
+%s: invalid escape sequence in field `%s'"), "LC_NAME", "name_fmt");
break;
}
}
@@ -139,8 +138,7 @@ No definition for %s category found"), "LC_NAME"));
if (name->cat == NULL) \
{ \
if (verbose && ! nothing) \
- WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"), \
- "LC_NAME", #cat)); \
+ record_warning (_("%s: field `%s' not defined"), "LC_NAME", #cat); \
name->cat = ""; \
}
diff --git a/locale/programs/ld-numeric.c b/locale/programs/ld-numeric.c
index 6e1d2b112e..58d5c5a4bc 100644
--- a/locale/programs/ld-numeric.c
+++ b/locale/programs/ld-numeric.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2016 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1995.
@@ -94,9 +94,8 @@ numeric_finish (struct localedef_t *locale, const struct charmap_t *charmap)
empty one. */
if (numeric == NULL)
{
- if (! be_quiet)
- WITH_CUR_LOCALE (error (0, 0, _("\
-No definition for %s category found"), "LC_NUMERIC"));
+ record_warning (_("\
+No definition for %s category found"), "LC_NUMERIC");
numeric_startup (NULL, locale, 0);
numeric = locale->categories[LC_NUMERIC].numeric;
nothing = 1;
@@ -108,23 +107,23 @@ No definition for %s category found"), "LC_NUMERIC"));
!= "". */
if (numeric->decimal_point == NULL)
{
- if (! be_quiet && ! nothing)
- WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"),
- "LC_NUMERIC", "decimal_point"));
+ if (! nothing)
+ record_error (0, 0, _("%s: field `%s' not defined"),
+ "LC_NUMERIC", "decimal_point");
numeric->decimal_point = ".";
}
- else if (numeric->decimal_point[0] == '\0' && ! be_quiet && ! nothing)
+ else if (numeric->decimal_point[0] == '\0' && ! nothing)
{
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
%s: value for field `%s' must not be an empty string"),
- "LC_NUMERIC", "decimal_point"));
+ "LC_NUMERIC", "decimal_point");
}
if (numeric->decimal_point_wc == L'\0')
numeric->decimal_point_wc = L'.';
- if (numeric->grouping_len == 0 && ! be_quiet && ! nothing)
- WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"),
- "LC_NUMERIC", "grouping"));
+ if (numeric->grouping_len == 0 && ! nothing)
+ record_error (0, 0, _("%s: field `%s' not defined"),
+ "LC_NUMERIC", "grouping");
}
diff --git a/locale/programs/ld-paper.c b/locale/programs/ld-paper.c
index 24ea684c40..6cbf4e990f 100644
--- a/locale/programs/ld-paper.c
+++ b/locale/programs/ld-paper.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2016 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -19,7 +19,6 @@
# include <config.h>
#endif
-#include <error.h>
#include <langinfo.h>
#include <string.h>
#include <stdint.h>
@@ -87,9 +86,8 @@ paper_finish (struct localedef_t *locale, const struct charmap_t *charmap)
empty one. */
if (paper == NULL)
{
- if (! be_quiet)
- WITH_CUR_LOCALE (error (0, 0, _("\
-No definition for %s category found"), "LC_PAPER"));
+ record_warning (_("\
+No definition for %s category found"), "LC_PAPER");
paper_startup (NULL, locale, 0);
paper = locale->categories[LC_PAPER].paper;
nothing = 1;
@@ -99,8 +97,8 @@ No definition for %s category found"), "LC_PAPER"));
if (paper->height == 0)
{
if (! nothing)
- WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"),
- "LC_PAPER", "height"));
+ record_error (0, 0, _("%s: field `%s' not defined"),
+ "LC_PAPER", "height");
/* Use as default values the values from the i18n locale. */
paper->height = 297;
}
@@ -108,8 +106,8 @@ No definition for %s category found"), "LC_PAPER"));
if (paper->width == 0)
{
if (! nothing)
- WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"),
- "LC_PAPER", "width"));
+ record_error (0, 0, _("%s: field `%s' not defined"),
+ "LC_PAPER", "width");
/* Use as default values the values from the i18n locale. */
paper->width = 210;
}
diff --git a/locale/programs/ld-telephone.c b/locale/programs/ld-telephone.c
index 6c38449d2c..f29f88a6e4 100644
--- a/locale/programs/ld-telephone.c
+++ b/locale/programs/ld-telephone.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2016 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -19,7 +19,6 @@
# include <config.h>
#endif
-#include <error.h>
#include <langinfo.h>
#include <string.h>
#include <stdint.h>
@@ -90,9 +89,8 @@ telephone_finish (struct localedef_t *locale, const struct charmap_t *charmap)
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;
@@ -102,10 +100,10 @@ No definition for %s category found"), "LC_TELEPHONE"));
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
{
@@ -114,17 +112,17 @@ No definition for %s category found"), "LC_TELEPHONE"));
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;
}
}
@@ -144,10 +142,10 @@ No definition for %s category found"), "LC_TELEPHONE"));
{
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;
}
}
@@ -159,8 +157,8 @@ No definition for %s category found"), "LC_TELEPHONE"));
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 = ""; \
}
diff --git a/locale/programs/ld-time.c b/locale/programs/ld-time.c
index ca31c9c81b..a755792363 100644
--- a/locale/programs/ld-time.c
+++ b/locale/programs/ld-time.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2016 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1995.
@@ -91,6 +91,12 @@ struct locale_time_t
const char *date_fmt;
const uint32_t *wdate_fmt;
int alt_digits_defined;
+ const char *alt_mon[12];
+ const uint32_t *walt_mon[12];
+ int alt_mon_defined;
+ const char *ab_alt_mon[12];
+ const uint32_t *wab_alt_mon[12];
+ int ab_alt_mon_defined;
unsigned char week_ndays;
uint32_t week_1stday;
unsigned char week_1stweek;
@@ -155,9 +161,8 @@ time_finish (struct localedef_t *locale, const struct charmap_t *charmap)
empty one. */
if (time == NULL)
{
- if (! be_quiet)
- WITH_CUR_LOCALE (error (0, 0, _("\
-No definition for %s category found"), "LC_TIME"));
+ record_warning (_("\
+No definition for %s category found"), "LC_TIME");
time_startup (NULL, locale, 0);
time = locale->categories[LC_TIME].time;
nothing = 1;
@@ -171,9 +176,9 @@ No definition for %s category found"), "LC_TIME"));
const char *initval[] = { noparen val }; \
unsigned int i; \
\
- if (! be_quiet && ! nothing) \
- WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"), \
- "LC_TIME", #cat)); \
+ if (! nothing) \
+ record_error (0, 0, _("%s: field `%s' not defined"), \
+ "LC_TIME", #cat); \
\
for (i = 0; i < sizeof (initval) / sizeof (initval[0]); ++i) \
time->cat[i] = initval[i]; \
@@ -192,9 +197,9 @@ No definition for %s category found"), "LC_TIME"));
#define TEST_ELEM(cat, initval) \
if (time->cat == NULL) \
{ \
- if (! be_quiet && ! nothing) \
- WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"), \
- "LC_TIME", #cat)); \
+ if (! nothing) \
+ record_error (0, 0, _("%s: field `%s' not defined"), \
+ "LC_TIME", #cat); \
\
time->cat = initval; \
}
@@ -243,10 +248,9 @@ No definition for %s category found"), "LC_TIME"));
/* First character must be + or - for the direction. */
if (*str != '+' && *str != '-')
{
- if (!be_quiet)
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
%s: direction flag in string %Zd in `era' field is not '+' nor '-'"),
- "LC_TIME", idx + 1));
+ "LC_TIME", idx + 1);
/* Default arbitrarily to '+'. */
time->era_entries[idx].direction = '+';
}
@@ -254,10 +258,9 @@ No definition for %s category found"), "LC_TIME"));
time->era_entries[idx].direction = *str;
if (*++str != ':')
{
- if (!be_quiet)
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
%s: direction flag in string %Zd in `era' field is not a single character"),
- "LC_TIME", idx + 1));
+ "LC_TIME", idx + 1);
(void) strsep (&str, ":");
}
else
@@ -267,18 +270,16 @@ No definition for %s category found"), "LC_TIME"));
time->era_entries[idx].offset = strtol (str, &endp, 10);
if (endp == str)
{
- if (!be_quiet)
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
%s: invalid number for offset in string %Zd in `era' field"),
- "LC_TIME", idx + 1));
+ "LC_TIME", idx + 1);
(void) strsep (&str, ":");
}
else if (*endp != ':')
{
- if (!be_quiet)
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
%s: garbage at end of offset value in string %Zd in `era' field"),
- "LC_TIME", idx + 1));
+ "LC_TIME", idx + 1);
(void) strsep (&str, ":");
}
else
@@ -326,19 +327,17 @@ No definition for %s category found"), "LC_TIME"));
if (endp == str)
{
invalid_start_date:
- if (!be_quiet)
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
%s: invalid starting date in string %Zd in `era' field"),
- "LC_TIME", idx + 1));
+ "LC_TIME", idx + 1);
(void) strsep (&str, ":");
}
else if (*endp != ':')
{
garbage_start_date:
- if (!be_quiet)
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
%s: garbage at end of starting date in string %Zd in `era' field "),
- "LC_TIME", idx + 1));
+ "LC_TIME", idx + 1);
(void) strsep (&str, ":");
}
else
@@ -353,11 +352,10 @@ No definition for %s category found"), "LC_TIME"));
> days_per_month[time->era_entries[idx].start_date[1]])
|| (time->era_entries[idx].start_date[1] == 2
&& time->era_entries[idx].start_date[2] == 29
- && !__isleap (time->era_entries[idx].start_date[0])))
- && !be_quiet)
- WITH_CUR_LOCALE (error (0, 0, _("\
+ && !__isleap (time->era_entries[idx].start_date[0]))))
+ record_error (0, 0, _("\
%s: starting date is invalid in string %Zd in `era' field"),
- "LC_TIME", idx + 1));
+ "LC_TIME", idx + 1);
}
}
@@ -403,19 +401,17 @@ No definition for %s category found"), "LC_TIME"));
if (endp == str)
{
invalid_stop_date:
- if (!be_quiet)
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
%s: invalid stopping date in string %Zd in `era' field"),
- "LC_TIME", idx + 1));
+ "LC_TIME", idx + 1);
(void) strsep (&str, ":");
}
else if (*endp != ':')
{
garbage_stop_date:
- if (!be_quiet)
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
%s: garbage at end of stopping date in string %Zd in `era' field"),
- "LC_TIME", idx + 1));
+ "LC_TIME", idx + 1);
(void) strsep (&str, ":");
}
else
@@ -430,19 +426,17 @@ No definition for %s category found"), "LC_TIME"));
> days_per_month[time->era_entries[idx].stop_date[1]])
|| (time->era_entries[idx].stop_date[1] == 2
&& time->era_entries[idx].stop_date[2] == 29
- && !__isleap (time->era_entries[idx].stop_date[0])))
- && !be_quiet)
- WITH_CUR_LOCALE (error (0, 0, _("\
+ && !__isleap (time->era_entries[idx].stop_date[0]))))
+ record_error (0, 0, _("\
%s: invalid stopping date in string %Zd in `era' field"),
- "LC_TIME", idx + 1));
+ "LC_TIME", idx + 1);
}
}
if (str == NULL || *str == '\0')
{
- if (!be_quiet)
- WITH_CUR_LOCALE (error (0, 0, _("\
-%s: missing era name in string %Zd in `era' field"), "LC_TIME", idx + 1));
+ record_error (0, 0, _("\
+%s: missing era name in string %Zd in `era' field"), "LC_TIME", idx + 1);
time->era_entries[idx].name =
time->era_entries[idx].format = "";
}
@@ -452,10 +446,9 @@ No definition for %s category found"), "LC_TIME"));
if (str == NULL || *str == '\0')
{
- if (!be_quiet)
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
%s: missing era format in string %Zd in `era' field"),
- "LC_TIME", idx + 1));
+ "LC_TIME", idx + 1);
time->era_entries[idx].name =
time->era_entries[idx].format = "";
}
@@ -487,40 +480,44 @@ No definition for %s category found"), "LC_TIME"));
}
}
+ /* Set up defaults based on ISO 30112 WD10 [2014]. */
if (time->week_ndays == 0)
time->week_ndays = 7;
if (time->week_1stday == 0)
time->week_1stday = 19971130;
+ if (time->week_1stweek == 0)
+ time->week_1stweek = 7;
+
if (time->week_1stweek > time->week_ndays)
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
%s: third operand for value of field `%s' must not be larger than %d"),
- "LC_TIME", "week", 7));
+ "LC_TIME", "week", 7);
if (time->first_weekday == '\0')
/* The definition does not specify this so the default is used. */
time->first_weekday = 1;
else if (time->first_weekday > time->week_ndays)
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
%s: values for field `%s' must not be larger than %d"),
- "LC_TIME", "first_weekday", 7));
+ "LC_TIME", "first_weekday", 7);
if (time->first_workday == '\0')
/* The definition does not specify this so the default is used. */
time->first_workday = 2;
else if (time->first_workday > time->week_ndays)
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
%s: values for field `%s' must not be larger than %d"),
- "LC_TIME", "first_workday", 7));
+ "LC_TIME", "first_workday", 7);
if (time->cal_direction == '\0')
/* The definition does not specify this so the default is used. */
time->cal_direction = 1;
else if (time->cal_direction > 3)
- WITH_CUR_LOCALE (error (0, 0, _("\
+ record_error (0, 0, _("\
%s: values for field `%s' must not be larger than %d"),
- "LC_TIME", "cal_direction", 3));
+ "LC_TIME", "cal_direction", 3);
/* XXX We don't perform any tests on the timezone value since this is
simply useless, stupid $&$!@... */
@@ -648,6 +645,23 @@ time_output (struct localedef_t *locale, const struct charmap_t *charmap,
add_locale_string (&file, time->date_fmt);
add_locale_wstring (&file, time->wdate_fmt);
add_locale_string (&file, charmap->code_set_name);
+
+ /* The alt'mons. */
+ for (n = 0; n < 12; ++n)
+ add_locale_string (&file, time->alt_mon[n] ?: "");
+
+ /* The wide character alt'mons. */
+ for (n = 0; n < 12; ++n)
+ add_locale_wstring (&file, time->walt_mon[n] ?: empty_wstr);
+
+ /* The ab'alt'mons. */
+ for (n = 0; n < 12; ++n)
+ add_locale_string (&file, time->ab_alt_mon[n] ?: "");
+
+ /* The wide character ab'alt'mons. */
+ for (n = 0; n < 12; ++n)
+ add_locale_wstring (&file, time->wab_alt_mon[n] ?: empty_wstr);
+
write_locale_data (output_path, LC_TIME, "LC_TIME", &file);
}
@@ -791,6 +805,8 @@ time_read (struct linereader *ldfile, struct localedef_t *result,
STRARR_ELEM (mon, 12, 12);
STRARR_ELEM (am_pm, 2, 2);
STRARR_ELEM (alt_digits, 0, 100);
+ STRARR_ELEM (alt_mon, 12, 12);
+ STRARR_ELEM (ab_alt_mon, 12, 12);
case tok_era:
/* Ignore the rest of the line if we don't need the input of
@@ -943,6 +959,21 @@ time_read (struct linereader *ldfile, struct localedef_t *result,
lr_error (ldfile, _("\
%1$s: definition does not end with `END %1$s'"), "LC_TIME");
lr_ignore_rest (ldfile, now->tok == tok_lc_time);
+
+ /* If alt_mon was not specified, make it a copy of mon. */
+ if (!ignore_content && !time->alt_mon_defined)
+ {
+ memcpy (time->alt_mon, time->mon, sizeof (time->mon));
+ memcpy (time->walt_mon, time->wmon, sizeof (time->wmon));
+ time->alt_mon_defined = 1;
+ }
+ /* The same for abbreviated versions. */
+ if (!ignore_content && !time->ab_alt_mon_defined)
+ {
+ memcpy (time->ab_alt_mon, time->abmon, sizeof (time->abmon));
+ memcpy (time->wab_alt_mon, time->wabmon, sizeof (time->wabmon));
+ time->ab_alt_mon_defined = 1;
+ }
return;
default:
diff --git a/locale/programs/linereader.c b/locale/programs/linereader.c
index b885f65d1f..3525c8a43d 100644
--- a/locale/programs/linereader.c
+++ b/locale/programs/linereader.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2016 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
@@ -634,7 +634,6 @@ get_string (struct linereader *lr, const struct charmap_t *charmap,
size_t buf2act = 0;
size_t buf2max = 56 * sizeof (uint32_t);
int ch;
- int warned = 0;
/* We have to provide the wide character result as well. */
if (return_widestr)
@@ -664,13 +663,6 @@ get_string (struct linereader *lr, const struct charmap_t *charmap,
break;
}
- if (verbose && !warned)
- {
- lr_error (lr, _("\
-non-symbolic character value should not be used"));
- warned = 1;
- }
-
ADDC (ch);
if (return_widestr)
ADDWC ((uint32_t) ch);
diff --git a/locale/programs/linereader.h b/locale/programs/linereader.h
index 5f423af44c..24fedaed92 100644
--- a/locale/programs/linereader.h
+++ b/locale/programs/linereader.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2016 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper, <drepper@gnu.org>.
@@ -27,7 +27,7 @@
#include "error.h"
#include "locfile-token.h"
#include "repertoire.h"
-
+#include "record-status.h"
typedef const struct keyword_t *(*kw_hash_fct_t) (const char *, unsigned int);
struct charset_t;
@@ -96,9 +96,29 @@ extern struct token *lr_token (struct linereader *lr,
extern void lr_ignore_rest (struct linereader *lr, int verbose);
-#define lr_error(lr, fmt, args...) \
- WITH_CUR_LOCALE (error_at_line (0, 0, lr->fname, lr->lineno, fmt, ## args))
+static inline void
+__attribute__ ((__format__ (__printf__, 2, 3), nonnull (1, 2)))
+lr_error (struct linereader *lr, const char *fmt, ...)
+{
+ char *str;
+ va_list arg;
+ struct locale_state ls;
+ int ret;
+
+ va_start (arg, fmt);
+ ls = push_locale ();
+
+ ret = vasprintf (&str, fmt, arg);
+ if (ret == -1)
+ abort ();
+ pop_locale (ls);
+ va_end (arg);
+
+ error_at_line (0, 0, lr->fname, lr->lineno, "%s", str);
+
+ free (str);
+}
static inline int
diff --git a/locale/programs/locale-spec.c b/locale/programs/locale-spec.c
index 80c9354dea..01dfe1ed60 100644
--- a/locale/programs/locale-spec.c
+++ b/locale/programs/locale-spec.c
@@ -1,5 +1,5 @@
/* Handle special requests.
- Copyright (C) 1996-2016 Free Software Foundation, Inc.
+ Copyright (C) 1996-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
@@ -53,7 +53,7 @@ locale_special (const char *name, int show_category_name,
size_t cnt;
for (cnt = 0; cnt < nelem; ++cnt)
- if (__collate_element_hash[2 * cnt] != (~((u_int32_t) 0)))
+ if (__collate_element_hash[2 * cnt] != (~((uint32_t) 0)))
{
size_t idx = __collate_element_hash[2 * cnt];
diff --git a/locale/programs/locale.c b/locale/programs/locale.c
index 6cb3d5ec64..86941e4ef6 100644
--- a/locale/programs/locale.c
+++ b/locale/programs/locale.c
@@ -1,5 +1,5 @@
/* Implementation of the locale program according to POSIX 9945-2.
- Copyright (C) 1995-2016 Free Software Foundation, Inc.
+ Copyright (C) 1995-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1995.
@@ -40,6 +40,7 @@
#include <sys/mman.h>
#include <sys/stat.h>
+#include "record-status.h"
#include "localeinfo.h"
#include "charmap-dir.h"
#include "../locarchive.h"
@@ -59,9 +60,6 @@ static int do_all;
/* Print names of all available character maps. */
static int do_charmaps = 0;
-/* Nonzero if verbose output is wanted. */
-static int verbose;
-
/* Name and version of program. */
static void print_version (FILE *stream, struct argp_state *state);
void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version;
@@ -295,7 +293,7 @@ print_version (FILE *stream, struct argp_state *state)
Copyright (C) %s Free Software Foundation, Inc.\n\
This is free software; see the source for copying conditions. There is NO\n\
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
-"), "2016");
+"), "2018");
fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper");
}
@@ -318,11 +316,9 @@ select_dirs (const struct dirent *dirent)
{
mode_t mode = 0;
-#ifdef _DIRENT_HAVE_D_TYPE
if (dirent->d_type != DT_UNKNOWN && dirent->d_type != DT_LNK)
mode = DTTOIF (dirent->d_type);
else
-#endif
{
struct stat64 st;
char buf[sizeof (COMPLOCALEDIR)
diff --git a/locale/programs/localedef.c b/locale/programs/localedef.c
index 6becd9aa2e..d718d2e9f4 100644
--- a/locale/programs/localedef.c
+++ b/locale/programs/localedef.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2016 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1995.
@@ -24,7 +24,6 @@
#include <fcntl.h>
#include <libintl.h>
#include <locale.h>
-#include <mcheck.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
@@ -33,6 +32,7 @@
#include <error.h>
#include <sys/mman.h>
#include <sys/stat.h>
+#include <ctype.h>
#include "localedef.h"
#include "charmap.h"
@@ -49,16 +49,6 @@ struct copy_def_list_t *copy_list;
/* If this is defined be POSIX conform. */
int posix_conformance;
-/* If not zero give a lot more messages. */
-int verbose;
-
-/* If not zero suppress warnings and information messages. */
-int be_quiet;
-
-/* If not zero, produce old-style hash table instead of 3-level access
- tables. */
-int oldstyle_tables;
-
/* If not zero force output even if warning were issued. */
static int force_output;
@@ -105,7 +95,6 @@ void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version;
#define OPT_POSIX 301
#define OPT_QUIET 302
-#define OPT_OLDSTYLE 303
#define OPT_PREFIX 304
#define OPT_NO_ARCHIVE 305
#define OPT_ADD_TO_ARCHIVE 306
@@ -114,6 +103,8 @@ void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version;
#define OPT_LIST_ARCHIVE 309
#define OPT_LITTLE_ENDIAN 400
#define OPT_BIG_ENDIAN 401
+#define OPT_NO_WARN 402
+#define OPT_WARN 403
/* Definitions of arguments for argp functions. */
static const struct argp_option options[] =
@@ -129,12 +120,18 @@ static const struct argp_option options[] =
{ NULL, 0, NULL, 0, N_("Output control:") },
{ "force", 'c', NULL, 0,
N_("Create output even if warning messages were issued") },
- { "old-style", OPT_OLDSTYLE, NULL, 0, N_("Create old-style tables") },
{ "prefix", OPT_PREFIX, N_("PATH"), 0, N_("Optional output file prefix") },
{ "posix", OPT_POSIX, NULL, 0, N_("Strictly conform to POSIX") },
{ "quiet", OPT_QUIET, NULL, 0,
N_("Suppress warnings and information messages") },
{ "verbose", 'v', NULL, 0, N_("Print more messages") },
+ { "no-warnings", OPT_NO_WARN, N_("<warnings>"), 0,
+ N_("Comma-separated list of warnings to disable; "
+ "supported warnings are: ascii, intcurrsym") },
+ { "warnings", OPT_WARN, N_("<warnings>"), 0,
+ N_("Comma-separated list of warnings to enable; "
+ "supported warnings are: ascii, intcurrsym") },
+
{ NULL, 0, NULL, 0, N_("Archive control:") },
{ "no-archive", OPT_NO_ARCHIVE, NULL, 0,
N_("Don't add new data to archive") },
@@ -243,8 +240,8 @@ main (int argc, char *argv[])
defines error code 3 for this situation so I think it must be
a fatal error (see P1003.2 4.35.8). */
if (sysconf (_SC_2_LOCALEDEF) < 0)
- WITH_CUR_LOCALE (error (3, 0, _("\
-FATAL: system does not define `_POSIX2_LOCALEDEF'")));
+ record_error (3, 0, _("\
+FATAL: system does not define `_POSIX2_LOCALEDEF'"));
/* Process charmap file. */
charmap = charmap_read (charmap_file, verbose, 1, be_quiet, 1);
@@ -257,8 +254,8 @@ FATAL: system does not define `_POSIX2_LOCALEDEF'")));
/* Now read the locale file. */
if (locfile_read (&global, charmap) != 0)
- WITH_CUR_LOCALE (error (4, errno, _("\
-cannot open locale definition file `%s'"), input_file));
+ record_error (4, errno, _("\
+cannot open locale definition file `%s'"), input_file);
/* Perhaps we saw some `copy' instructions. */
while (1)
@@ -273,31 +270,80 @@ cannot open locale definition file `%s'"), input_file));
break;
if (locfile_read (runp, charmap) != 0)
- WITH_CUR_LOCALE (error (4, errno, _("\
-cannot open locale definition file `%s'"), runp->name));
+ record_error (4, errno, _("\
+cannot open locale definition file `%s'"), runp->name);
}
/* Check the categories we processed in source form. */
check_all_categories (locales, charmap);
- /* We are now able to write the data files. If warning were given we
- do it only if it is explicitly requested (--force). */
- if (error_message_count == 0 || force_output != 0)
+ /* What we do next depends on the number of errors and warnings we
+ have generated in processing the input files.
+
+ * No errors: Write the output file.
+
+ * Some warnings: Write the output file and exit with status 1 to
+ indicate there may be problems using the output file e.g. missing
+ data that makes it difficult to use
+
+ * Errors: We don't write the output file and we exit with status 4
+ to indicate no output files were written.
+
+ The use of -c|--force writes the output file even if errors were
+ seen. */
+ if (recorded_error_count == 0 || force_output != 0)
{
if (cannot_write_why != 0)
- WITH_CUR_LOCALE (error (4, cannot_write_why, _("\
-cannot write output files to `%s'"), output_path ? : argv[remaining]));
+ record_error (4, cannot_write_why, _("\
+cannot write output files to `%s'"), output_path ? : argv[remaining]);
else
write_all_categories (locales, charmap, argv[remaining], output_path);
}
else
- WITH_CUR_LOCALE (error (4, 0, _("\
-no output file produced because warnings were issued")));
+ record_error (4, 0, _("\
+no output file produced because errors were issued"));
/* This exit status is prescribed by POSIX.2 4.35.7. */
- exit (error_message_count != 0);
+ exit (recorded_warning_count != 0);
}
+/* Search warnings for matching warnings and if found enable those
+ warnings if ENABLED is true, otherwise disable the warnings. */
+static void
+set_warnings (char *warnings, bool enabled)
+{
+ char *tok = warnings;
+ char *copy = (char *) malloc (strlen (warnings) + 1);
+ char *save = copy;
+
+ /* As we make a copy of the warnings list we remove all spaces from
+ the warnings list to make the processing a more robust. We don't
+ support spaces in a warning name. */
+ do
+ {
+ while (isspace (*tok) != 0)
+ tok++;
+ }
+ while ((*save++ = *tok++) != '\0');
+
+ warnings = copy;
+
+ /* Tokenize the input list of warnings to set, compare them to
+ known warnings, and set the warning. We purposely ignore unknown
+ warnings, and are thus forward compatible, users can attempt to
+ disable whaterver new warnings they know about, but we will only
+ disable those *we* known about. */
+ while ((tok = strtok_r (warnings, ",", &save)) != NULL)
+ {
+ warnings = NULL;
+ if (strcmp (tok, "ascii") == 0)
+ warn_ascii = enabled;
+ else if (strcmp (tok, "intcurrsym") == 0)
+ warn_int_curr_symbol = enabled;
+ }
+
+ free (copy);
+}
/* Handle program arguments. */
static error_t
@@ -311,9 +357,6 @@ parse_opt (int key, char *arg, struct argp_state *state)
case OPT_POSIX:
posix_conformance = 1;
break;
- case OPT_OLDSTYLE:
- oldstyle_tables = 1;
- break;
case OPT_PREFIX:
output_prefix = arg;
break;
@@ -338,6 +381,14 @@ parse_opt (int key, char *arg, struct argp_state *state)
case OPT_BIG_ENDIAN:
set_big_endian (true);
break;
+ case OPT_NO_WARN:
+ /* Disable the warnings. */
+ set_warnings (arg, false);
+ break;
+ case OPT_WARN:
+ /* Enable the warnings. */
+ set_warnings (arg, true);
+ break;
case 'c':
force_output = 1;
break;
@@ -403,7 +454,7 @@ print_version (FILE *stream, struct argp_state *state)
Copyright (C) %s Free Software Foundation, Inc.\n\
This is free software; see the source for copying conditions. There is NO\n\
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
-"), "2016");
+"), "2018");
fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper");
}
@@ -577,14 +628,14 @@ add_to_readlist (int category, const char *name, const char *repertoire_name,
if (generate
&& (runp->needed & (1 << category)) != 0
&& (runp->avail & (1 << category)) == 0)
- WITH_CUR_LOCALE (error (5, 0, _("\
-circular dependencies between locale definitions")));
+ record_error (5, 0, _("\
+circular dependencies between locale definitions"));
if (copy_locale != NULL)
{
if (runp->categories[category].generic != NULL)
- WITH_CUR_LOCALE (error (5, 0, _("\
-cannot add already read locale `%s' a second time"), name));
+ record_error (5, 0, _("\
+cannot add already read locale `%s' a second time"), name);
else
runp->categories[category].generic =
copy_locale->categories[category].generic;
@@ -609,8 +660,8 @@ find_locale (int category, const char *name, const char *repertoire_name,
if ((result->avail & (1 << category)) == 0
&& locfile_read (result, charmap) != 0)
- WITH_CUR_LOCALE (error (4, errno, _("\
-cannot open locale definition file `%s'"), result->name));
+ record_error (4, errno, _("\
+cannot open locale definition file `%s'"), result->name);
return result;
}
@@ -629,19 +680,8 @@ load_locale (int category, const char *name, const char *repertoire_name,
if ((result->avail & (1 << category)) == 0
&& locfile_read (result, charmap) != 0)
- WITH_CUR_LOCALE (error (4, errno, _("\
-cannot open locale definition file `%s'"), result->name));
+ record_error (4, errno, _("\
+cannot open locale definition file `%s'"), result->name);
return result;
}
-
-static void
-turn_on_mcheck (void)
-{
- /* Enable `malloc' debugging. */
- mcheck (NULL);
- /* Use the following line for a more thorough but much slower testing. */
- /* mcheck_pedantic (NULL); */
-}
-
-void (*__malloc_initialize_hook) (void) = turn_on_mcheck;
diff --git a/locale/programs/localedef.h b/locale/programs/localedef.h
index cb9386a798..0083faceab 100644
--- a/locale/programs/localedef.h
+++ b/locale/programs/localedef.h
@@ -1,5 +1,5 @@
/* General definitions for localedef(1).
- Copyright (C) 1998-2016 Free Software Foundation, Inc.
+ Copyright (C) 1998-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -24,7 +24,11 @@
#include <locale.h>
#include <stdbool.h>
#include <stddef.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include "record-status.h"
#include "repertoire.h"
#include "../locarchive.h"
@@ -110,9 +114,6 @@ struct localedef_t
/* Global variables of the localedef program. */
-extern int verbose;
-extern int be_quiet;
-extern int oldstyle_tables;
extern const char *repertoire_global;
extern int max_locarchive_open_retry;
extern bool no_archive;
@@ -123,19 +124,6 @@ extern const char *alias_file;
#include <programs/xmalloc.h>
-/* Wrapper to switch LC_CTYPE back to the locale specified in the
- environment for output. */
-#define WITH_CUR_LOCALE(stmt) \
- do { \
- int saved_errno = errno; \
- const char *cur_locale_ = setlocale (LC_CTYPE, NULL); \
- setlocale (LC_CTYPE, ""); \
- errno = saved_errno; \
- stmt; \
- setlocale (LC_CTYPE, cur_locale_); \
- } while (0)
-
-
/* Mark given locale as to be read. */
extern struct localedef_t *add_to_readlist (int locale, const char *name,
const char *repertoire_name,
diff --git a/locale/programs/locarchive.c b/locale/programs/locarchive.c
index fadc3bfd43..ca332a345f 100644
--- a/locale/programs/locarchive.c
+++ b/locale/programs/locarchive.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2016 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -40,8 +40,8 @@
#include <sys/shm.h>
#include <sys/stat.h>
-#include <libc-internal.h>
#include <libc-mmap.h>
+#include <libc-pointer-arith.h>
#include "../../crypt/md5.h"
#include "../localeinfo.h"
#include "../locarchive.h"
@@ -320,8 +320,8 @@ compare_from_file (struct locarhandle *ah, void *p1, uint32_t offset2,
{
void *p2 = xmalloc (size);
if (pread (ah->fd, p2, size, offset2) != size)
- WITH_CUR_LOCALE (error (4, errno,
- _("cannot read data from locale archive")));
+ record_error (4, errno,
+ _("cannot read data from locale archive"));
int res = memcmp (p1, p2, size);
free (p2);
@@ -1385,17 +1385,13 @@ add_locales_to_archive (size_t nlist, char *list[], bool replace)
a directory we have to look at a file with the
prefix "SYS_". Otherwise we have found what we
are looking for. */
-#ifdef _DIRENT_HAVE_D_TYPE
d_type = d->d_type;
if (d_type != DT_REG)
-#endif
{
char fullname[fnamelen + 2 * strlen (d->d_name) + 7];
-#ifdef _DIRENT_HAVE_D_TYPE
if (d_type == DT_UNKNOWN)
-#endif
{
strcpy (stpcpy (stpcpy (fullname, fname), "/"),
d->d_name);
diff --git a/locale/programs/locfile-kw.gperf b/locale/programs/locfile-kw.gperf
index 5fea6964ff..6bf2f6018b 100644
--- a/locale/programs/locfile-kw.gperf
+++ b/locale/programs/locfile-kw.gperf
@@ -1,5 +1,5 @@
%{
-/* Copyright (C) 1996-2016 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
@@ -148,6 +148,8 @@ first_workday, tok_first_workday, 0
cal_direction, tok_cal_direction, 0
timezone, tok_timezone, 0
date_fmt, tok_date_fmt, 0
+alt_mon, tok_alt_mon, 0
+ab_alt_mon, tok_ab_alt_mon, 0
LC_MESSAGES, tok_lc_messages, 0
yesexpr, tok_yesexpr, 0
noexpr, tok_noexpr, 0
diff --git a/locale/programs/locfile-kw.h b/locale/programs/locfile-kw.h
index 16b87d415a..d25cf992f2 100644
--- a/locale/programs/locfile-kw.h
+++ b/locale/programs/locfile-kw.h
@@ -30,7 +30,7 @@
#line 1 "locfile-kw.gperf"
-/* Copyright (C) 1996-2016 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
@@ -54,7 +54,7 @@
#line 24 "locfile-kw.gperf"
struct keyword_t ;
-#define TOTAL_KEYWORDS 176
+#define TOTAL_KEYWORDS 178
#define MIN_WORD_LENGTH 3
#define MAX_WORD_LENGTH 22
#define MIN_HASH_VALUE 3
@@ -147,22 +147,22 @@ locfile_hash (register const char *str, register unsigned int len)
#line 30 "locfile-kw.gperf"
{"LC_CTYPE", tok_lc_ctype, 0},
{""},
-#line 166 "locfile-kw.gperf"
+#line 168 "locfile-kw.gperf"
{"LC_ADDRESS", tok_lc_address, 0},
-#line 151 "locfile-kw.gperf"
+#line 153 "locfile-kw.gperf"
{"LC_MESSAGES", tok_lc_messages, 0},
-#line 159 "locfile-kw.gperf"
+#line 161 "locfile-kw.gperf"
{"LC_NAME", tok_lc_name, 0},
-#line 156 "locfile-kw.gperf"
+#line 158 "locfile-kw.gperf"
{"LC_PAPER", tok_lc_paper, 0},
-#line 184 "locfile-kw.gperf"
+#line 186 "locfile-kw.gperf"
{"LC_MEASUREMENT", tok_lc_measurement, 0},
#line 56 "locfile-kw.gperf"
{"LC_COLLATE", tok_lc_collate, 0},
{""},
-#line 186 "locfile-kw.gperf"
+#line 188 "locfile-kw.gperf"
{"LC_IDENTIFICATION", tok_lc_identification, 0},
-#line 199 "locfile-kw.gperf"
+#line 201 "locfile-kw.gperf"
{"revision", tok_revision, 0},
#line 69 "locfile-kw.gperf"
{"UNDEFINED", tok_undefined, 0},
@@ -170,19 +170,19 @@ locfile_hash (register const char *str, register unsigned int len)
{"LC_NUMERIC", tok_lc_numeric, 0},
#line 82 "locfile-kw.gperf"
{"LC_MONETARY", tok_lc_monetary, 0},
-#line 179 "locfile-kw.gperf"
+#line 181 "locfile-kw.gperf"
{"LC_TELEPHONE", tok_lc_telephone, 0},
{""}, {""}, {""},
#line 75 "locfile-kw.gperf"
{"define", tok_define, 0},
-#line 152 "locfile-kw.gperf"
+#line 154 "locfile-kw.gperf"
{"yesexpr", tok_yesexpr, 0},
#line 141 "locfile-kw.gperf"
{"era_year", tok_era_year, 0},
{""},
#line 54 "locfile-kw.gperf"
{"translit_ignore", tok_translit_ignore, 0},
-#line 154 "locfile-kw.gperf"
+#line 156 "locfile-kw.gperf"
{"yesstr", tok_yesstr, 0},
{""},
#line 89 "locfile-kw.gperf"
@@ -190,7 +190,7 @@ locfile_hash (register const char *str, register unsigned int len)
{""},
#line 137 "locfile-kw.gperf"
{"t_fmt", tok_t_fmt, 0},
-#line 157 "locfile-kw.gperf"
+#line 159 "locfile-kw.gperf"
{"height", tok_height, 0},
{""}, {""},
#line 52 "locfile-kw.gperf"
@@ -213,7 +213,7 @@ locfile_hash (register const char *str, register unsigned int len)
{""},
#line 142 "locfile-kw.gperf"
{"era_d_fmt", tok_era_d_fmt, 0},
-#line 187 "locfile-kw.gperf"
+#line 189 "locfile-kw.gperf"
{"title", tok_title, 0},
{""}, {""},
#line 149 "locfile-kw.gperf"
@@ -243,7 +243,7 @@ locfile_hash (register const char *str, register unsigned int len)
{"duo_n_cs_precedes", tok_duo_n_cs_precedes, 0},
#line 127 "locfile-kw.gperf"
{"thousands_sep", tok_thousands_sep, 0},
-#line 195 "locfile-kw.gperf"
+#line 197 "locfile-kw.gperf"
{"territory", tok_territory, 0},
#line 36 "locfile-kw.gperf"
{"digit", tok_digit, 0},
@@ -258,7 +258,7 @@ locfile_hash (register const char *str, register unsigned int len)
{""},
#line 78 "locfile-kw.gperf"
{"else", tok_else, 0},
-#line 182 "locfile-kw.gperf"
+#line 184 "locfile-kw.gperf"
{"int_select", tok_int_select, 0},
{""}, {""}, {""},
#line 132 "locfile-kw.gperf"
@@ -266,11 +266,11 @@ locfile_hash (register const char *str, register unsigned int len)
#line 33 "locfile-kw.gperf"
{"upper", tok_upper, 0},
{""}, {""},
-#line 192 "locfile-kw.gperf"
+#line 194 "locfile-kw.gperf"
{"tel", tok_tel, 0},
#line 93 "locfile-kw.gperf"
{"p_sep_by_space", tok_p_sep_by_space, 0},
-#line 158 "locfile-kw.gperf"
+#line 160 "locfile-kw.gperf"
{"width", tok_width, 0},
{""},
#line 98 "locfile-kw.gperf"
@@ -301,7 +301,7 @@ locfile_hash (register const char *str, register unsigned int len)
{""}, {""}, {""}, {""}, {""},
#line 58 "locfile-kw.gperf"
{"section-symbol", tok_section_symbol, 0},
-#line 183 "locfile-kw.gperf"
+#line 185 "locfile-kw.gperf"
{"int_prefix", tok_int_prefix, 0},
{""}, {""}, {""}, {""},
#line 42 "locfile-kw.gperf"
@@ -318,7 +318,7 @@ locfile_hash (register const char *str, register unsigned int len)
{"duo_p_sep_by_space", tok_duo_p_sep_by_space, 0},
#line 118 "locfile-kw.gperf"
{"duo_int_p_sign_posn", tok_duo_int_p_sign_posn, 0},
-#line 155 "locfile-kw.gperf"
+#line 157 "locfile-kw.gperf"
{"nostr", tok_nostr, 0},
{""}, {""},
#line 140 "locfile-kw.gperf"
@@ -327,26 +327,26 @@ locfile_hash (register const char *str, register unsigned int len)
#line 84 "locfile-kw.gperf"
{"currency_symbol", tok_currency_symbol, 0},
{""},
-#line 165 "locfile-kw.gperf"
+#line 167 "locfile-kw.gperf"
{"name_ms", tok_name_ms, 0},
-#line 163 "locfile-kw.gperf"
+#line 165 "locfile-kw.gperf"
{"name_mrs", tok_name_mrs, 0},
-#line 164 "locfile-kw.gperf"
+#line 166 "locfile-kw.gperf"
{"name_miss", tok_name_miss, 0},
#line 83 "locfile-kw.gperf"
{"int_curr_symbol", tok_int_curr_symbol, 0},
-#line 188 "locfile-kw.gperf"
+#line 190 "locfile-kw.gperf"
{"source", tok_source, 0},
-#line 162 "locfile-kw.gperf"
+#line 164 "locfile-kw.gperf"
{"name_mr", tok_name_mr, 0},
-#line 161 "locfile-kw.gperf"
+#line 163 "locfile-kw.gperf"
{"name_gen", tok_name_gen, 0},
-#line 200 "locfile-kw.gperf"
+#line 202 "locfile-kw.gperf"
{"date", tok_date, 0},
{""}, {""},
-#line 189 "locfile-kw.gperf"
+#line 191 "locfile-kw.gperf"
{"address", tok_address, 0},
-#line 160 "locfile-kw.gperf"
+#line 162 "locfile-kw.gperf"
{"name_fmt", tok_name_fmt, 0},
#line 32 "locfile-kw.gperf"
{"copy", tok_copy, 0},
@@ -365,16 +365,16 @@ locfile_hash (register const char *str, register unsigned int len)
#line 117 "locfile-kw.gperf"
{"duo_n_sign_posn", tok_duo_n_sign_posn, 0},
{""},
-#line 168 "locfile-kw.gperf"
+#line 170 "locfile-kw.gperf"
{"country_name", tok_country_name, 0},
#line 71 "locfile-kw.gperf"
{"reorder-after", tok_reorder_after, 0},
{""}, {""},
-#line 153 "locfile-kw.gperf"
+#line 155 "locfile-kw.gperf"
{"noexpr", tok_noexpr, 0},
#line 50 "locfile-kw.gperf"
{"tolower", tok_tolower, 0},
-#line 196 "locfile-kw.gperf"
+#line 198 "locfile-kw.gperf"
{"audience", tok_audience, 0},
{""}, {""}, {""},
#line 49 "locfile-kw.gperf"
@@ -395,7 +395,7 @@ locfile_hash (register const char *str, register unsigned int len)
{""},
#line 102 "locfile-kw.gperf"
{"int_p_sign_posn", tok_int_p_sign_posn, 0},
-#line 173 "locfile-kw.gperf"
+#line 175 "locfile-kw.gperf"
{"country_car", tok_country_car, 0},
{""}, {""},
#line 104 "locfile-kw.gperf"
@@ -406,9 +406,9 @@ locfile_hash (register const char *str, register unsigned int len)
{""}, {""},
#line 116 "locfile-kw.gperf"
{"duo_p_sign_posn", tok_duo_p_sign_posn, 0},
-#line 185 "locfile-kw.gperf"
+#line 187 "locfile-kw.gperf"
{"measurement", tok_measurement, 0},
-#line 174 "locfile-kw.gperf"
+#line 176 "locfile-kw.gperf"
{"country_isbn", tok_country_isbn, 0},
#line 37 "locfile-kw.gperf"
{"outdigit", tok_outdigit, 0},
@@ -418,9 +418,9 @@ locfile_hash (register const char *str, register unsigned int len)
{""}, {""}, {""},
#line 34 "locfile-kw.gperf"
{"lower", tok_lower, 0},
-#line 181 "locfile-kw.gperf"
+#line 183 "locfile-kw.gperf"
{"tel_dom_fmt", tok_tel_dom_fmt, 0},
-#line 169 "locfile-kw.gperf"
+#line 171 "locfile-kw.gperf"
{"country_post", tok_country_post, 0},
#line 148 "locfile-kw.gperf"
{"cal_direction", tok_cal_direction, 0},
@@ -430,7 +430,7 @@ locfile_hash (register const char *str, register unsigned int len)
#line 91 "locfile-kw.gperf"
{"frac_digits", tok_frac_digits, 0},
{""}, {""},
-#line 175 "locfile-kw.gperf"
+#line 177 "locfile-kw.gperf"
{"lang_name", tok_lang_name, 0},
#line 90 "locfile-kw.gperf"
{"int_frac_digits", tok_int_frac_digits, 0},
@@ -445,7 +445,7 @@ locfile_hash (register const char *str, register unsigned int len)
{""}, {""}, {""}, {""},
#line 107 "locfile-kw.gperf"
{"duo_frac_digits", tok_duo_frac_digits, 0},
-#line 180 "locfile-kw.gperf"
+#line 182 "locfile-kw.gperf"
{"tel_int_fmt", tok_tel_int_fmt, 0},
#line 123 "locfile-kw.gperf"
{"duo_valid_to", tok_duo_valid_to, 0},
@@ -455,7 +455,7 @@ locfile_hash (register const char *str, register unsigned int len)
#line 130 "locfile-kw.gperf"
{"abday", tok_abday, 0},
{""},
-#line 198 "locfile-kw.gperf"
+#line 200 "locfile-kw.gperf"
{"abbreviation", tok_abbreviation, 0},
#line 147 "locfile-kw.gperf"
{"first_workday", tok_first_workday, 0},
@@ -472,12 +472,12 @@ locfile_hash (register const char *str, register unsigned int len)
#line 45 "locfile-kw.gperf"
{"blank", tok_blank, 0},
{""}, {""},
-#line 194 "locfile-kw.gperf"
+#line 196 "locfile-kw.gperf"
{"language", tok_language, 0},
#line 120 "locfile-kw.gperf"
{"uno_valid_from", tok_uno_valid_from, 0},
{""},
-#line 197 "locfile-kw.gperf"
+#line 199 "locfile-kw.gperf"
{"application", tok_application, 0},
{""},
#line 80 "locfile-kw.gperf"
@@ -498,7 +498,7 @@ locfile_hash (register const char *str, register unsigned int len)
#line 96 "locfile-kw.gperf"
{"p_sign_posn", tok_p_sign_posn, 0},
{""},
-#line 201 "locfile-kw.gperf"
+#line 203 "locfile-kw.gperf"
{"category", tok_category, 0},
{""}, {""}, {""}, {""},
#line 134 "locfile-kw.gperf"
@@ -510,29 +510,29 @@ locfile_hash (register const char *str, register unsigned int len)
#line 63 "locfile-kw.gperf"
{"order_start", tok_order_start, 0},
{""}, {""}, {""}, {""}, {""},
-#line 176 "locfile-kw.gperf"
- {"lang_ab", tok_lang_ab, 0},
#line 178 "locfile-kw.gperf"
+ {"lang_ab", tok_lang_ab, 0},
+#line 180 "locfile-kw.gperf"
{"lang_lib", tok_lang_lib, 0},
{""}, {""}, {""},
-#line 190 "locfile-kw.gperf"
+#line 192 "locfile-kw.gperf"
{"contact", tok_contact, 0},
{""}, {""}, {""},
-#line 171 "locfile-kw.gperf"
+#line 173 "locfile-kw.gperf"
{"country_ab3", tok_country_ab3, 0},
{""}, {""}, {""},
-#line 191 "locfile-kw.gperf"
+#line 193 "locfile-kw.gperf"
{"email", tok_email, 0},
-#line 170 "locfile-kw.gperf"
+#line 172 "locfile-kw.gperf"
{"country_ab2", tok_country_ab2, 0},
{""}, {""}, {""},
#line 55 "locfile-kw.gperf"
{"default_missing", tok_default_missing, 0},
{""}, {""},
-#line 193 "locfile-kw.gperf"
+#line 195 "locfile-kw.gperf"
{"fax", tok_fax, 0},
{""}, {""}, {""}, {""}, {""}, {""}, {""},
-#line 172 "locfile-kw.gperf"
+#line 174 "locfile-kw.gperf"
{"country_num", tok_country_num, 0},
{""}, {""}, {""}, {""}, {""}, {""},
#line 51 "locfile-kw.gperf"
@@ -548,7 +548,9 @@ locfile_hash (register const char *str, register unsigned int len)
{"endif", tok_endif, 0},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
- {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
+ {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
+#line 151 "locfile-kw.gperf"
+ {"alt_mon", tok_alt_mon, 0},
{""}, {""}, {""}, {""}, {""}, {""}, {""},
#line 76 "locfile-kw.gperf"
{"undef", tok_undef, 0},
@@ -558,7 +560,9 @@ locfile_hash (register const char *str, register unsigned int len)
#line 59 "locfile-kw.gperf"
{"collating-element", tok_collating_element, 0},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
- {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
+ {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
+#line 152 "locfile-kw.gperf"
+ {"ab_alt_mon", tok_ab_alt_mon, 0},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
@@ -569,7 +573,7 @@ locfile_hash (register const char *str, register unsigned int len)
#line 85 "locfile-kw.gperf"
{"mon_decimal_point", tok_mon_decimal_point, 0},
{""}, {""},
-#line 167 "locfile-kw.gperf"
+#line 169 "locfile-kw.gperf"
{"postal_fmt", tok_postal_fmt, 0},
{""}, {""}, {""}, {""}, {""},
#line 60 "locfile-kw.gperf"
@@ -588,7 +592,7 @@ locfile_hash (register const char *str, register unsigned int len)
#line 87 "locfile-kw.gperf"
{"mon_grouping", tok_mon_grouping, 0},
{""},
-#line 177 "locfile-kw.gperf"
+#line 179 "locfile-kw.gperf"
{"lang_term", tok_lang_term, 0},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
diff --git a/locale/programs/locfile-token.h b/locale/programs/locfile-token.h
index d6e7a8b4ac..e3cd18e5f0 100644
--- a/locale/programs/locfile-token.h
+++ b/locale/programs/locfile-token.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2016 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
@@ -186,6 +186,8 @@ enum token_t
tok_cal_direction,
tok_timezone,
tok_date_fmt,
+ tok_alt_mon,
+ tok_ab_alt_mon,
tok_lc_messages,
tok_yesexpr,
tok_noexpr,
diff --git a/locale/programs/locfile.c b/locale/programs/locfile.c
index 32f5cd2a79..32e5f761f2 100644
--- a/locale/programs/locfile.c
+++ b/locale/programs/locfile.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2016 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
@@ -796,9 +796,8 @@ write_locale_data (const char *output_path, int catidx, const char *category,
if (fd == -1)
{
- if (!be_quiet)
- WITH_CUR_LOCALE (error (0, save_err, _("\
-cannot open output file `%s' for category `%s'"), fname, category));
+ record_error (0, save_err, _("\
+cannot open output file `%s' for category `%s'"), fname, category);
free (fname);
return;
}
@@ -820,9 +819,8 @@ cannot open output file `%s' for category `%s'"), fname, category));
if (writev (fd, &vec[cnt], step) < 0)
{
- if (!be_quiet)
- WITH_CUR_LOCALE (error (0, errno, _("\
-failure while writing data for category `%s'"), category));
+ record_error (0, errno, _("\
+failure while writing data for category `%s'"), category);
break;
}
}
@@ -916,9 +914,8 @@ failure while writing data for category `%s'"), category));
unlink (fname);
if (rename (tmp_fname, fname) < 0)
{
- if (!be_quiet)
- WITH_CUR_LOCALE (error (0, errno, _("\
-cannot create output file `%s' for category `%s'"), fname, category));
+ record_error (0, errno, _("\
+cannot create output file `%s' for category `%s'"), fname, category);
}
free (tmp_fname);
free (other_fname);
diff --git a/locale/programs/locfile.h b/locale/programs/locfile.h
index a3dd90412a..89b347c72d 100644
--- a/locale/programs/locfile.h
+++ b/locale/programs/locfile.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2016 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
diff --git a/locale/programs/record-status.c b/locale/programs/record-status.c
new file mode 100644
index 0000000000..730679a795
--- /dev/null
+++ b/locale/programs/record-status.c
@@ -0,0 +1,229 @@
+/* Functions for recorded errors, warnings, and verbose messages.
+ Copyright (C) 1998-2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <stdbool.h>
+#include <string.h>
+#include <error.h>
+#include <errno.h>
+#include <locale.h>
+
+#include "record-status.h"
+
+/* Warnings recorded by record_warnings. */
+int recorded_warning_count;
+
+/* Errors recorded by record_errors. */
+int recorded_error_count;
+
+/* If not zero suppress warnings and information messages. */
+int be_quiet;
+
+/* If not zero give a lot more messages. */
+int verbose;
+
+/* Warnings which can be disabled: */
+/* By default we check the character map for ASCII compatibility. */
+bool warn_ascii = true;
+/* By default we check that the international currency symbol matches a
+ known country code. */
+bool warn_int_curr_symbol = true;
+
+/* Alter the current locale to match the locale configured by the
+ user, and return the previous saved state. */
+struct locale_state
+push_locale (void)
+{
+ int saved_errno;
+ const char *orig;
+ char *copy = NULL;
+
+ saved_errno = errno;
+
+ orig = setlocale (LC_CTYPE, NULL);
+ if (orig == NULL)
+ error (0, 0, "failed to read locale!");
+
+ if (setlocale (LC_CTYPE, "") == NULL)
+ error (0, 0, "failed to set locale!");
+
+ errno = saved_errno;
+
+ if (orig != NULL)
+ copy = strdup (orig);
+
+ /* We will return either a valid locale or NULL if we failed
+ to save the locale. */
+ return (struct locale_state) { .cur_locale = copy };
+}
+
+/* Use the saved state to restore the locale. */
+void
+pop_locale (struct locale_state ls)
+{
+ const char *set = NULL;
+ /* We might have failed to save the locale, so only attempt to
+ restore a validly saved non-NULL locale. */
+ if (ls.cur_locale != NULL)
+ {
+ set = setlocale (LC_CTYPE, ls.cur_locale);
+ if (set == NULL)
+ error (0, 0, "failed to restore %s locale!", ls.cur_locale);
+
+ free (ls.cur_locale);
+ }
+}
+
+/* Wrapper to print verbose informative messages.
+ Verbose messages are only printed if --verbose
+ is in effect and --quiet is not. */
+void
+__attribute__ ((__format__ (__printf__, 2, 3), nonnull (1, 2), unused))
+record_verbose (FILE *stream, const char *format, ...)
+{
+ char *str;
+ va_list arg;
+
+ if (!verbose)
+ return;
+
+ if (!be_quiet)
+ {
+ struct locale_state ls;
+ int ret;
+
+ va_start (arg, format);
+ ls = push_locale ();
+
+ ret = vasprintf (&str, format, arg);
+ if (ret == -1)
+ abort ();
+
+ pop_locale (ls);
+ va_end (arg);
+
+ fprintf (stream, "[verbose] %s\n", str);
+
+ free (str);
+ }
+}
+
+/* Wrapper to print warning messages. We keep track of how
+ many were called because this effects our exit code.
+ Nothing is printed if --quiet is in effect, but warnings
+ are always counted. */
+void
+__attribute__ ((__format__ (__printf__, 1, 2), nonnull (1), unused))
+record_warning (const char *format, ...)
+{
+ char *str;
+ va_list arg;
+
+ recorded_warning_count++;
+
+ if (!be_quiet)
+ {
+ struct locale_state ls;
+ int ret;
+
+ va_start (arg, format);
+ ls = push_locale ();
+
+ ret = vasprintf (&str, format, arg);
+ if (ret == -1)
+ abort ();
+
+ pop_locale (ls);
+ va_end (arg);
+
+ fprintf (stderr, "[warning] %s\n", str);
+
+ free (str);
+ }
+}
+
+/* Wrapper to print error messages. We keep track of how
+ many were called because this effects our exit code.
+ Nothing is printed if --quiet is in effect, but errors
+ are always counted, and fatal errors always exit the
+ program. */
+void
+__attribute__ ((__format__ (__printf__, 3, 4), nonnull (3), unused))
+record_error (int status, int errnum, const char *format, ...)
+{
+ char *str;
+ va_list arg;
+
+ recorded_error_count++;
+
+ /* The existing behaviour is that even if you use --quiet, a fatal
+ error is always printed and terminates the process. */
+ if (!be_quiet || status != 0)
+ {
+ struct locale_state ls;
+ int ret;
+
+ va_start (arg, format);
+ ls = push_locale ();
+
+ ret = vasprintf (&str, format, arg);
+ if (ret == -1)
+ abort ();
+
+ pop_locale (ls);
+ va_end (arg);
+
+ error (status, errnum, "[error] %s", str);
+
+ free (str);
+ }
+}
+/* ... likewise for error_at_line. */
+void
+__attribute__ ((__format__ (__printf__, 5, 6), nonnull (3, 5), unused))
+record_error_at_line (int status, int errnum, const char *filename,
+ unsigned int linenum, const char *format, ...)
+{
+ char *str;
+ va_list arg;
+
+ recorded_error_count++;
+
+ /* The existing behaviour is that even if you use --quiet, a fatal
+ error is always printed and terminates the process. */
+ if (!be_quiet || status != 0)
+ {
+ struct locale_state ls;
+ int ret;
+
+ va_start (arg, format);
+ ls = push_locale ();
+
+ ret = vasprintf (&str, format, arg);
+ if (ret == -1)
+ abort ();
+
+ pop_locale (ls);
+ va_end (arg);
+
+ error_at_line (status, errnum, filename, linenum, "[error] %s", str);
+
+ free (str);
+ }
+}
diff --git a/locale/programs/record-status.h b/locale/programs/record-status.h
new file mode 100644
index 0000000000..7ea0b5be8f
--- /dev/null
+++ b/locale/programs/record-status.h
@@ -0,0 +1,51 @@
+/* General definitions for recording error and warning status.
+ Copyright (C) 1998-2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef _RECORD_STATUS_H
+#define _RECORD_STATUS_H 1
+
+#include <stdio.h>
+#include <stdbool.h>
+
+/* Error, warning and verbose count and control. */
+extern int recorded_warning_count;
+extern int recorded_error_count;
+extern int be_quiet;
+extern int verbose;
+extern bool warn_ascii;
+extern bool warn_int_curr_symbol;
+
+/* Record verbose, warnings, or errors... */
+void record_verbose (FILE *stream, const char *format, ...);
+void record_warning (const char *format, ...);
+void record_error (int status, int errnum, const char *format, ...);
+void record_error_at_line (int status, int errnum,
+ const char *filename, unsigned int linenum,
+ const char *format, ...);
+
+/* Locale related functionality for custom error functions. */
+struct locale_state
+{
+ /* The current in-use locale. */
+ char *cur_locale;
+};
+
+struct locale_state push_locale (void);
+void pop_locale (struct locale_state ls);
+
+
+#endif
diff --git a/locale/programs/repertoire.c b/locale/programs/repertoire.c
index c39870759c..ac83988ebf 100644
--- a/locale/programs/repertoire.c
+++ b/locale/programs/repertoire.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2016 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -20,7 +20,6 @@
#endif
#include <errno.h>
-#include <error.h>
#include <limits.h>
#include <obstack.h>
#include <search.h>
@@ -321,14 +320,14 @@ argument to <%s> must be a single character"),
}
if (state != 2 && state != 90 && !be_quiet)
- WITH_CUR_LOCALE (error (0, 0, _("%s: premature end of file"),
- repfile->fname));
+ record_error (0, 0, _("%s: premature end of file"),
+ repfile->fname);
lr_close (repfile);
if (tsearch (result, &known, &repertoire_compare) == NULL)
/* Something went wrong. */
- WITH_CUR_LOCALE (error (0, errno, _("cannot save new repertoire map")));
+ record_error (0, errno, _("cannot save new repertoire map"));
return result;
}
@@ -339,8 +338,8 @@ repertoire_complain (const char *name)
{
if (tfind (name, &unavailable, (__compar_fn_t) strcmp) == NULL)
{
- WITH_CUR_LOCALE (error (0, errno, _("\
-repertoire map file `%s' not found"), name));
+ record_error (0, errno, _("\
+repertoire map file `%s' not found"), name);
/* Remember that we reported this map. */
tsearch (name, &unavailable, (__compar_fn_t) strcmp);
diff --git a/locale/programs/repertoire.h b/locale/programs/repertoire.h
index a426a3cba6..6a9c7b4257 100644
--- a/locale/programs/repertoire.h
+++ b/locale/programs/repertoire.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2016 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
diff --git a/locale/programs/simple-hash.c b/locale/programs/simple-hash.c
index a79539a1c9..66bb474deb 100644
--- a/locale/programs/simple-hash.c
+++ b/locale/programs/simple-hash.c
@@ -1,5 +1,5 @@
/* Implement simple hashing table with string based keys.
- Copyright (C) 1994-2016 Free Software Foundation, Inc.
+ Copyright (C) 1994-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, October 1994.
diff --git a/locale/programs/simple-hash.h b/locale/programs/simple-hash.h
index cc3f85655c..ce55a70879 100644
--- a/locale/programs/simple-hash.h
+++ b/locale/programs/simple-hash.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2016 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1995.
diff --git a/locale/programs/xmalloc.c b/locale/programs/xmalloc.c
index 7524fa5083..be1e43d920 100644
--- a/locale/programs/xmalloc.c
+++ b/locale/programs/xmalloc.c
@@ -1,5 +1,5 @@
/* xmalloc.c -- malloc with out of memory checking
- Copyright (C) 1990-2016 Free Software Foundation, Inc.
+ Copyright (C) 1990-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
This program is free software; you can redistribute it and/or modify
diff --git a/locale/programs/xstrdup.c b/locale/programs/xstrdup.c
index 534ac56e36..7331d6410f 100644
--- a/locale/programs/xstrdup.c
+++ b/locale/programs/xstrdup.c
@@ -1,5 +1,5 @@
/* xstrdup.c -- copy a string with out of memory checking
- Copyright (C) 1990-2016 Free Software Foundation, Inc.
+ Copyright (C) 1990-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
This program is free software; you can redistribute it and/or modify