]> sourceware.org Git - glibc.git/blame - posix/bug-regex5.c
#undef __isnanf and isnanf after reading the headers.
[glibc.git] / posix / bug-regex5.c
CommitLineData
2f76d88d
UD
1#include <stdio.h>
2#include <string.h>
3#include <locale.h>
4#include <locale/localeinfo.h>
5
6int
7main (void)
8{
9 int32_t table_size, idx, i, found;
10 const int32_t *symb_table;
11 const unsigned char *extra;
12 uint32_t nrules;
13 char *ca;
14
15 ca = setlocale (LC_ALL, "da_DK.ISO-8859-1");
16 if (ca == NULL)
17 {
18 printf ("cannot set locale: %m\n");
19 return 1;
20 }
21 printf ("current locale : %s\n", ca);
22
418f1701 23 nrules = (size_t) nl_langinfo (_NL_COLLATE_NRULES);
2f76d88d
UD
24 if (nrules == 0)
25 {
26 printf("No rule\n");
27 return 1;
28 }
29
418f1701
UD
30 table_size = (size_t) nl_langinfo (_NL_COLLATE_SYMB_HASH_SIZEMB);
31 symb_table = (const int32_t *) nl_langinfo (_NL_COLLATE_SYMB_TABLEMB);
32 extra = (const unsigned char *) nl_langinfo (_NL_COLLATE_SYMB_EXTRAMB);
2f76d88d
UD
33
34 found = 0;
35 for (i = 0; i < table_size; ++i)
36 {
37 if (symb_table[2 * i] != 0)
38 {
39 char elem[256];
40 idx = symb_table[2 * i + 1];
41 strncpy (elem, extra + idx + 1, extra[idx]);
42 elem[extra[idx]] = '\0';
43 printf ("Found a collating element: %s\n", elem);
44 ++found;
45 }
46 }
47 if (found == 0)
48 {
49 printf ("No collating element!\n");
50 return 1;
51 }
52 else if (found != 4)
53 {
54 printf ("expected 4 collating elements, found %d\n", found);
55 return 1;
56 }
57
58 return 0;
59}
This page took 0.79086 seconds and 5 git commands to generate.