#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <locale.h>
typedef struct {
const char *key;
} Line;
-int
+static int
compare_collate (const void *a, const void *b)
{
const Line *line_a = a;
return g_utf8_collate (line_a->str, line_b->str);
}
-int
+static int
compare_key (const void *a, const void *b)
{
const Line *line_a = a;
guint i;
gboolean do_key = FALSE;
gboolean do_file = FALSE;
+ gchar *locale;
+
+ /* FIXME: need to modify environment here,
+ * since g_utf8_collate_key calls setlocal (LC_COLLATE, "")
+ */
+ g_setenv ("LC_ALL", "en_US", TRUE);
+ locale = setlocale (LC_ALL, "");
+ if (locale == NULL || strcmp (locale, "en_US") != 0)
+ {
+ fprintf (stderr, "No suitable locale, skipping test\n");
+ return 2;
+ }
if (argc != 1 && argc != 2 && argc != 3)
{