powerpc: Optimized strncat for POWER8
[glibc.git] / localedata / bug-setlocale1.c
blob546ea7beb8116728ca7c74ce82a187f57d426db3
1 // BZ 12788
2 #include <locale.h>
3 #include <stdio.h>
4 #include <stdlib.h>
5 #include <string.h>
6 #include <unistd.h>
9 static int
10 do_test (void)
12 int result = 0;
14 char *a = setlocale (LC_ALL, "");
15 printf ("setlocale(LC_ALL, \"\") = %s\n", a);
16 if (a == NULL)
17 return 1;
18 a = strdupa (a);
20 char *b = setlocale (LC_CTYPE, "");
21 printf ("setlocale(LC_CTYPE, \"\") = %s\n", b);
22 if (b == NULL)
23 return 1;
25 char *c = setlocale (LC_ALL, NULL);
26 printf ("setlocale(LC_ALL, NULL) = %s\n", c);
27 if (c == NULL)
28 return 1;
29 c = strdupa (c);
31 if (strcmp (a, c) != 0)
33 puts ("*** first and third result do not match");
34 result = 1;
37 char *d = setlocale (LC_NUMERIC, "");
38 printf ("setlocale(LC_NUMERIC, \"\") = %s\n", d);
39 if (d == NULL)
40 return 1;
42 if (strcmp (d, "C") != 0)
44 puts ("*** LC_NUMERIC not C");
45 result = 1;
48 char *e = setlocale (LC_ALL, NULL);
49 printf ("setlocale(LC_ALL, NULL) = %s\n", e);
50 if (e == NULL)
51 return 1;
53 if (strcmp (a, e) != 0)
55 puts ("*** first and fifth result do not match");
56 result = 1;
59 char *f = setlocale (LC_ALL, "C");
60 printf ("setlocale(LC_ALL, \"C\") = %s\n", f);
61 if (f == NULL)
62 return 1;
64 if (strcmp (f, "C") != 0)
66 puts ("*** LC_ALL not C");
67 result = 1;
70 char *g = setlocale (LC_ALL, NULL);
71 printf ("setlocale(LC_ALL, NULL) = %s\n", g);
72 if (g == NULL)
73 return 1;
75 if (strcmp (g, "C") != 0)
77 puts ("*** LC_ALL not C");
78 result = 1;
81 char *h = setlocale (LC_CTYPE, NULL);
82 printf ("setlocale(LC_CTYPE, NULL) = %s\n", h);
83 if (h == NULL)
84 return 1;
86 if (strcmp (h, "C") != 0)
88 puts ("*** LC_CTYPE not C");
89 result = 1;
92 return result;
95 #define TEST_FUNCTION do_test ()
96 #include "../test-skeleton.c"