* autogen.sh (GNULIB_MODULES_LIBGETTEXTPO): Add xstrerror.
* gnulib-local/lib/markup.c: Include xstrerror.h.
(unescape_string_inplace): Use xstrerror instead of strerror.
* gnulib-local/modules/markup (Depends-on): Add xstrerror.
* gettext-tools/src/read-po-lex.c: Include xstrerror.h.
(mbfile_getc, lex_getc): Use xstrerror instead of strerror.
* gettext-tools/src/read-properties.c: Include xstrerror.h.
(properties_parse): Use xstrerror instead of strerror.
* gettext-tools/src/read-stringtable.c: Include xstrerror.h.
(phase1_getc): Use xstrerror instead of strerror.
* gettext-tools/src/write-catalog.c: Include xstrerror.h.
(msgdomain_list_print): Use xstrerror instead of strerror.
xalloc
xconcat-filename
xmalloca
+ xstrerror
xstriconv
xvasprintf
'
#include "po-charset.h"
#include "xalloc.h"
#include "xvasprintf.h"
+#include "xstrerror.h"
#include "po-error.h"
#include "xerror-handler.h"
#include "xmalloca.h"
}
else
{
- const char *errno_description = strerror (errno);
+ int err = errno;
ps->catr->xeh->xerror (CAT_SEVERITY_FATAL_ERROR,
NULL, NULL, 0, 0, false,
- xasprintf ("%s: %s",
- _("iconv failure"),
- errno_description));
+ xstrerror (_("iconv failure"), err));
}
}
else
if (ferror (ps->mbf->fp))
bomb:
{
- const char *errno_description = strerror (errno);
+ int err = errno;
ps->catr->xeh->xerror (CAT_SEVERITY_FATAL_ERROR,
NULL, NULL, 0, 0, false,
- xasprintf ("%s: %s",
- xasprintf (_("error while reading \"%s\""),
+ xstrerror (xasprintf (_("error while reading \"%s\""),
ps->gram_pos.file_name),
- errno_description));
+ err));
}
break;
}
#include "read-catalog-abstract.h"
#include "xalloc.h"
#include "xvasprintf.h"
+#include "xstrerror.h"
#include "xerror-handler.h"
#include "msgl-ascii.h"
#include "read-file.h"
contents = fread_file (file, 0, &contents_length);
if (contents == NULL)
{
- const char *errno_description = strerror (errno);
+ int err = errno;
catr->xeh->xerror (CAT_SEVERITY_FATAL_ERROR, NULL, NULL, 0, 0, false,
- xasprintf ("%s: %s",
- xasprintf (_("error while reading \"%s\""),
+ xstrerror (xasprintf (_("error while reading \"%s\""),
real_filename),
- errno_description));
+ err));
return;
}
#include "read-catalog-abstract.h"
#include "xalloc.h"
#include "xvasprintf.h"
+#include "xstrerror.h"
#include "xerror-handler.h"
#include "unistr.h"
#include "gettext.h"
{
if (ferror (fp))
{
- const char *errno_description = strerror (errno);
+ int err = errno;
catr->xeh->xerror (CAT_SEVERITY_FATAL_ERROR, NULL, NULL, 0, 0, false,
- xasprintf ("%s: %s",
- xasprintf (_("error while reading \"%s\""),
+ xstrerror (xasprintf (_("error while reading \"%s\""),
real_file_name),
- errno_description));
+ err));
}
return EOF;
}
#include "fwriteerror.h"
#include "xvasprintf.h"
+#include "xstrerror.h"
#include "xerror-handler.h"
#include "gettext.h"
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
if (fd < 0)
{
- const char *errno_description = strerror (errno);
+ int err = errno;
xeh->xerror (CAT_SEVERITY_FATAL_ERROR, NULL, NULL, 0, 0, false,
- xasprintf ("%s: %s",
- xasprintf (_("cannot create output file \"%s\""),
+ xstrerror (xasprintf (_("cannot create output file \"%s\""),
filename),
- errno_description));
+ err));
}
}
else
/* Make sure nothing went wrong. */
if (close (fd) < 0)
{
- const char *errno_description = strerror (errno);
+ int err = errno;
xeh->xerror (CAT_SEVERITY_FATAL_ERROR, NULL, NULL, 0, 0, false,
- xasprintf ("%s: %s",
- xasprintf (_("error while writing \"%s\" file"),
+ xstrerror (xasprintf (_("error while writing \"%s\" file"),
filename),
- errno_description));
+ err));
}
}
else
fp = fopen (filename, "wb");
if (fp == NULL)
{
- const char *errno_description = strerror (errno);
+ int err = errno;
xeh->xerror (CAT_SEVERITY_FATAL_ERROR, NULL, NULL, 0, 0, false,
- xasprintf ("%s: %s",
- xasprintf (_("cannot create output file \"%s\""),
+ xstrerror (xasprintf (_("cannot create output file \"%s\""),
filename),
- errno_description));
+ err));
}
}
else
/* Make sure nothing went wrong. */
if (fwriteerror (fp))
{
- const char *errno_description = strerror (errno);
+ int err = errno;
xeh->xerror (CAT_SEVERITY_FATAL_ERROR, NULL, NULL, 0, 0, false,
- xasprintf ("%s: %s",
- xasprintf (_("error while writing \"%s\" file"),
+ xstrerror (xasprintf (_("error while writing \"%s\" file"),
filename),
- errno_description));
+ err));
}
}
}
/* markup.c -- simple XML-like parser
- Copyright (C) 2015, 2018, 2020 Free Software Foundation, Inc.
+ Copyright (C) 2015-2024 Free Software Foundation, Inc.
This file is not part of the GNU gettext program, but is used with
GNU gettext.
#include "unistr.h"
#include "xalloc.h"
#include "xvasprintf.h"
+#include "xstrerror.h"
#define _(s) gettext(s)
char *error_text =
xasprintf (_("invalid character reference: %s"),
errno != 0
- ? strerror (errno)
+ ? xstrerror (NULL, errno)
: _("not a valid number specification"));
emit_error (context, error_text);
free (error_text);
xalloc
xlist
xvasprintf
+xstrerror
configure.ac: