3 <<tolower>>---translate characters to lowercase
12 int tolower(int <[c]>);
13 int _tolower(int <[c]>);
22 <<tolower>> is a macro which converts uppercase characters to lowercase,
23 leaving all other characters unchanged. It is only defined when
24 <[c]> is an integer in the range <<EOF>> to <<255>>.
26 You can use a compiled subroutine instead of the macro definition by
27 undefining this macro using `<<#undef tolower>>'.
29 <<_tolower>> performs the same conversion as <<tolower>>, but should
30 only be used when <[c]> is known to be an uppercase character (<<A>>--<<Z>>).
33 <<tolower>> returns the lowercase equivalent of <[c]> when it is a
34 character between <<A>> and <<Z>>, and <[c]> otherwise.
36 <<_tolower>> returns the lowercase equivalent of <[c]> when it is a
37 character between <<A>> and <<Z>>. If <[c]> is not one of these
38 characters, the behaviour of <<_tolower>> is undefined.
41 <<tolower>> is ANSI C. <<_tolower>> is not recommended for portable
44 No supporting OS subroutines are required.
49 #if defined (_MB_EXTENDED_CHARSETS_ISO) || defined (_MB_EXTENDED_CHARSETS_WINDOWS)
59 _DEFUN(tolower,(c),int c)
61 #if defined (_MB_EXTENDED_CHARSETS_ISO) || defined (_MB_EXTENDED_CHARSETS_WINDOWS)
62 if ((unsigned char) c <= 0x7f)
63 return isupper (c) ? c - 'A' + 'a' : c;
64 else if (c != EOF && MB_CUR_MAX == 1 && isupper (c))
66 char s[MB_LEN_MAX] = { c, '\0' };
68 if (mbtowc (&wc, s, 1) >= 0
69 && wctomb (s, (wchar_t) towlower ((wint_t) wc)) == 1)
70 c = (unsigned char) s[0];
74 return isupper(c) ? (c) - 'A' + 'a' : c;