10 do_test (int argc
, char *argv
[])
16 if (argc
!= 2 && argc
!= 5)
18 printf ("wrong number of arguments (%d)\n", argc
);
22 for (i
= 0; i
< (argc
== 5 ? 4 : 1); i
++)
23 newargv
[i
] = argv
[i
+ 1];
27 env
[0] = (char *) "LC_CTYPE=de_DE.UTF-8";
28 char *loc
= getenv ("LOCPATH");
29 if (loc
== NULL
|| loc
[0] == '\0')
31 puts ("LOCPATH not set");
34 asprintf (&env
[1], "LOCPATH=%s", loc
);
37 puts ("asprintf failed");
42 execve (newargv
[0], newargv
, env
);
44 puts ("execve returned");
50 char *a
= setlocale (LC_ALL
, "");
51 printf ("setlocale(LC_ALL, \"\") = %s\n", a
);
56 char *b
= setlocale (LC_CTYPE
, "");
57 printf ("setlocale(LC_CTYPE, \"\") = %s\n", b
);
61 char *c
= setlocale (LC_ALL
, NULL
);
62 printf ("setlocale(LC_ALL, NULL) = %s\n", c
);
67 if (strcmp (a
, c
) != 0)
69 puts ("*** first and third result do not match");
73 char *d
= setlocale (LC_NUMERIC
, "");
74 printf ("setlocale(LC_NUMERIC, \"\") = %s\n", d
);
78 if (strcmp (d
, "C") != 0)
80 puts ("*** LC_NUMERIC not C");
84 char *e
= setlocale (LC_ALL
, NULL
);
85 printf ("setlocale(LC_ALL, NULL) = %s\n", e
);
89 if (strcmp (a
, e
) != 0)
91 puts ("*** first and fifth result do not match");
95 char *f
= setlocale (LC_ALL
, "C");
96 printf ("setlocale(LC_ALL, \"C\") = %s\n", f
);
100 if (strcmp (f
, "C") != 0)
102 puts ("*** LC_ALL not C");
106 char *g
= setlocale (LC_ALL
, NULL
);
107 printf ("setlocale(LC_ALL, NULL) = %s\n", g
);
111 if (strcmp (g
, "C") != 0)
113 puts ("*** LC_ALL not C");
117 char *h
= setlocale (LC_CTYPE
, NULL
);
118 printf ("setlocale(LC_CTYPE, NULL) = %s\n", h
);
122 if (strcmp (h
, "C") != 0)
124 puts ("*** LC_CTYPE not C");
131 #define TEST_FUNCTION do_test (argc, argv)
132 #include "../test-skeleton.c"