This source file includes following definitions.
- collate_error
- xmemcoll
- xmemcoll0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 #include <config.h>
21
22 #include <errno.h>
23 #include <stdlib.h>
24
25 #include "gettext.h"
26 #define _(msgid) gettext (msgid)
27
28 #include "error.h"
29 #include "exitfail.h"
30 #include "memcoll.h"
31 #include "quotearg.h"
32 #include "xmemcoll.h"
33
34 static void
35 collate_error (int collation_errno,
36 char const *s1, size_t s1len,
37 char const *s2, size_t s2len)
38 {
39 error (0, collation_errno, _("string comparison failed"));
40 error (0, 0, _("Set LC_ALL='C' to work around the problem."));
41 error (exit_failure, 0,
42 _("The strings compared were %s and %s."),
43 quotearg_n_style_mem (0, locale_quoting_style, s1, s1len),
44 quotearg_n_style_mem (1, locale_quoting_style, s2, s2len));
45 }
46
47
48
49
50
51
52
53 int
54 xmemcoll (char *s1, size_t s1len, char *s2, size_t s2len)
55 {
56 int diff = memcoll (s1, s1len, s2, s2len);
57 int collation_errno = errno;
58 if (collation_errno)
59 collate_error (collation_errno, s1, s1len, s2, s2len);
60 return diff;
61 }
62
63
64
65
66
67
68 int
69 xmemcoll0 (char const *s1, size_t s1size, char const *s2, size_t s2size)
70 {
71 int diff = memcoll0 (s1, s1size, s2, s2size);
72 int collation_errno = errno;
73 if (collation_errno)
74 collate_error (collation_errno, s1, s1size - 1, s2, s2size - 1);
75 return diff;
76 }