Remove suppression-related options.
[coreutils.git] / lib / xmemcoll.c
blob433d67f9c49eb8f6185df652e3fd76e208edd7e5
1 /* Locale-specific memory comparison.
2 Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software Foundation,
16 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
18 /* Contributed by Paul Eggert <eggert@twinsun.com>. */
20 #if HAVE_CONFIG_H
21 # include <config.h>
22 #endif
24 #include <errno.h>
25 #include <stdlib.h>
27 #include "gettext.h"
28 #define _(msgid) gettext (msgid)
30 #include "error.h"
31 #include "exitfail.h"
32 #include "memcoll.h"
33 #include "quotearg.h"
34 #include "xmemcoll.h"
36 /* Compare S1 (with length S1LEN) and S2 (with length S2LEN) according
37 to the LC_COLLATE locale. S1 and S2 do not overlap, and are not
38 adjacent. Temporarily modify the bytes after S1 and S2, but
39 restore their original contents before returning. Report an error
40 and exit if there is an error. */
42 int
43 xmemcoll (char *s1, size_t s1len, char *s2, size_t s2len)
45 int diff = memcoll (s1, s1len, s2, s2len);
46 int collation_errno = errno;
48 if (collation_errno)
50 error (0, collation_errno, _("string comparison failed"));
51 error (0, 0, _("Set LC_ALL='C' to work around the problem."));
52 error (exit_failure, 0,
53 _("The strings compared were %s and %s."),
54 quotearg_n_style_mem (0, locale_quoting_style, s1, s1len),
55 quotearg_n_style_mem (1, locale_quoting_style, s2, s2len));
58 return diff;