4 #include <locale/localeinfo.h>
9 int32_t table_size, idx, i, found;
10 const int32_t *symb_table;
11 const unsigned char *extra;
15 ca = setlocale (LC_ALL, "da_DK.ISO-8859-1");
18 printf ("cannot set locale: %m\n");
21 printf ("current locale : %s\n", ca);
23 nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
30 table_size = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_SYMB_HASH_SIZEMB);
31 symb_table = (const int32_t *)
32 _NL_CURRENT (LC_COLLATE, _NL_COLLATE_SYMB_TABLEMB);
33 extra = (const unsigned char *)
34 _NL_CURRENT (LC_COLLATE, _NL_COLLATE_SYMB_EXTRAMB);
37 for (i = 0; i < table_size; ++i)
39 if (symb_table[2 * i] != 0)
42 idx = symb_table[2 * i + 1];
43 strncpy (elem, extra + idx + 1, extra[idx]);
44 elem[extra[idx]] = '\0';
45 printf ("Found a collating element: %s\n", elem);
51 printf ("No collating element!\n");
56 printf ("expected 4 collating elements, found %d\n", found);