20 l = newlocale (LC_ALL_MASK, "de_DE.ISO-8859-1", NULL);
23 puts ("newlocale failed");
27 memset (&tm, '\0', sizeof (tm));
33 if (strftime (buf, sizeof (buf), "%e %^B %Y", &tm) == 0)
35 puts ("initial strftime failed");
38 if (strcmp (buf, " 1 MARCH 2002") != 0)
40 printf ("initial strftime: expected \"%s\", got \"%s\"\n",
41 " 1 MARCH 2002", buf);
45 printf ("got \"%s\"\n", buf);
47 /* Now using the extended locale model. */
48 if (strftime_l (buf, sizeof (buf), "%e %^B %Y", &tm, l) == 0)
50 puts ("strftime_l failed");
53 else if (strcmp (buf, " 1 M\xc4RZ 2002") != 0)
55 printf ("strftime_l: expected \"%s\", got \"%s\"\n",
56 " 1 M\xc4RZ 2002", buf);
61 setlocale (LC_ALL, "de_DE.ISO-8859-1");
62 printf ("got \"%s\"\n", buf);
63 setlocale (LC_ALL, "C");
66 /* And the wide character version. */
67 if (wcsftime_l (wbuf, sizeof (wbuf) / sizeof (wbuf[0]), L"%e %^B %Y", &tm, l)
70 puts ("wcsftime_l failed");
73 else if (wcscmp (wbuf, L" 1 M\x00c4RZ 2002") != 0)
75 printf ("wcsftime_l: expected \"%ls\", got \"%ls\"\n",
76 L" 1 M\x00c4RZ 2002", wbuf);
81 setlocale (LC_ALL, "de_DE.ISO-8859-1");
82 printf ("got \"%ls\"\n", wbuf);
83 setlocale (LC_ALL, "C");
88 n = strftime (buf, sizeof (buf), "%e %^B %Y", &tm);
91 (void) uselocale (old);
95 puts ("strftime after first uselocale failed");
98 else if (strcmp (buf, " 1 M\xc4RZ 2002") != 0)
100 printf ("strftime in non-C locale: expected \"%s\", got \"%s\"\n",
101 " 1 M\xc4RZ 2002", buf);
106 setlocale (LC_ALL, "de_DE.ISO-8859-1");
107 printf ("got \"%s\"\n", buf);
108 setlocale (LC_ALL, "C");
111 if (strftime (buf, sizeof (buf), "%e %^B %Y", &tm) == 0)
113 puts ("strftime after second uselocale failed");
116 else if (strcmp (buf, " 1 MARCH 2002") != 0)
118 printf ("initial strftime: expected \"%s\", got \"%s\"\n",
119 " 1 MARCH 2002", buf);
123 printf ("got \"%s\"\n", buf);