3 #if defined (_MB_EXTENDED_CHARSETS_ISO) || defined (_MB_EXTENDED_CHARSETS_WINDOWS)
9 #include "../locale/setlocale.h"
13 tolower_l (int c
, struct __locale_t
*locale
)
15 #if defined (_MB_EXTENDED_CHARSETS_ISO) || defined (_MB_EXTENDED_CHARSETS_WINDOWS)
16 if ((unsigned char) c
<= 0x7f)
17 return isupper_l (c
, locale
) ? c
- 'A' + 'a' : c
;
18 else if (c
!= EOF
&& __locale_mb_cur_max_l (locale
) == 1
19 && isupper_l (c
, locale
))
21 char s
[MB_LEN_MAX
] = { c
, '\0' };
25 memset (&state
, 0, sizeof state
);
26 if (locale
->mbtowc (_REENT
, &wc
, s
, 1, &state
) >= 0
27 && locale
->wctomb (_REENT
, s
,
28 (wchar_t) towlower_l ((wint_t) wc
, locale
),
30 c
= (unsigned char) s
[0];
34 return isupper_l (c
, locale
) ? (c
) - 'A' + 'a' : c
;