1 #include <wctype.h>
2 #include <string.h>
3
wctrans(const char * class)4 wctrans_t wctrans(const char *class)
5 {
6 if (!strcmp(class, "toupper")) return (wctrans_t)1;
7 if (!strcmp(class, "tolower")) return (wctrans_t)2;
8 return 0;
9 }
10
towctrans(wint_t wc,wctrans_t trans)11 wint_t towctrans(wint_t wc, wctrans_t trans)
12 {
13 if (trans == (wctrans_t)1) return towupper(wc);
14 if (trans == (wctrans_t)2) return towlower(wc);
15 return wc;
16 }
17
__wctrans_l(const char * s,locale_t l)18 wctrans_t __wctrans_l(const char *s, locale_t l)
19 {
20 return wctrans(s);
21 }
22
__towctrans_l(wint_t c,wctrans_t t,locale_t l)23 wint_t __towctrans_l(wint_t c, wctrans_t t, locale_t l)
24 {
25 return towctrans(c, t);
26 }
27
28 weak_alias(__wctrans_l, wctrans_l);
29 weak_alias(__towctrans_l, towctrans_l);
30