mirror of
git://git.sv.gnu.org/coreutils.git
synced 2026-02-15 11:52:15 +02:00
* maint.mk: (sc_error_message_warn_fatal, sc_error_message_uppercase): (sc_error_message_period): Add automatic checks for non-standard error messages. * .x-sc_error_message_uppercase: explicit exclusion for this check * src/cp.c: Standardize some error messages. * src/date.c: Likewise. * src/dircolors.c: Likewise. * src/du.c: Likewise. * src/expr.c: Likewise. * src/install.c: Likewise. * src/join.c: Likewise. * src/ln.c: Likewise. * src/mv.c: Likewise. * src/od.c: Likewise. * src/pr.c: Likewise. * src/split.c: Likewise. * src/truncate.c: Likewise. * src/wc.c: Likewise. * tests/du/files0-from: Expect new error message. * tests/misc/join: Likewise. * tests/misc/split-a: Likewise. * tests/misc/wc-files0-from: Likewise. * tests/misc/xstrtol: Likewise. * lib/xmemxfrm.c: Likewise.
63 lines
2.0 KiB
C
63 lines
2.0 KiB
C
/* Locale-specific memory transformation
|
|
|
|
Copyright (C) 2006 Free Software Foundation, Inc.
|
|
|
|
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, either version 3 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/>. */
|
|
|
|
/* Written by Paul Eggert <eggert@cs.ucla.edu>. */
|
|
|
|
#include <config.h>
|
|
|
|
#include "xmemxfrm.h"
|
|
|
|
#include <errno.h>
|
|
#include <stdlib.h>
|
|
|
|
#include "gettext.h"
|
|
#define _(msgid) gettext (msgid)
|
|
|
|
#include "error.h"
|
|
#include "exitfail.h"
|
|
#include "memxfrm.h"
|
|
#include "quotearg.h"
|
|
|
|
/* Store into DEST (of size DESTSIZE) the text in SRC (of size
|
|
SRCSIZE) transformed so that the result of memcmp on two
|
|
transformed texts (with ties going to the longer text) is the same
|
|
as the result of memcoll on the two texts before their
|
|
transformation. Perhaps temporarily modify the byte after SRC, but
|
|
restore its original contents before returning.
|
|
|
|
Return the size of the resulting text. DEST contains an
|
|
indeterminate value if the resulting size is greater than DESTSIZE.
|
|
Report an error and exit if there is an error. */
|
|
|
|
size_t
|
|
xmemxfrm (char *restrict dest, size_t destsize,
|
|
char *restrict src, size_t srcsize)
|
|
{
|
|
size_t translated_size = memxfrm (dest, destsize, src, srcsize);
|
|
|
|
if (errno)
|
|
{
|
|
error (0, errno, _("string transformation failed"));
|
|
error (0, 0, _("set LC_ALL='C' to work around the problem"));
|
|
error (exit_failure, 0,
|
|
_("the untransformed string was %s"),
|
|
quotearg_n_style_mem (0, locale_quoting_style, src, srcsize));
|
|
}
|
|
|
|
return translated_size;
|
|
}
|