44909e85efe703adcc2e0f18eabb4680fe7d3202
[fw/pdclib] / platform / altos / functions / ctype / tolower.c
1 /* $Id$ */
2
3 /* tolower( int )
4
5    This file is part of the Public Domain C Library (PDCLib).
6    Permission is granted to use, modify, and / or redistribute at will.
7 */
8
9 #include <ctype.h>
10
11 #ifndef REGTEST
12
13 #include <locale.h>
14
15 int tolower( int c )
16 {
17         if ('A' <= c && c <= 'Z')
18                 c = c + 'a' - 'A';
19         return c;
20 }
21
22 #endif
23
24 #ifdef TEST
25 #include <_PDCLIB_test.h>
26
27 int main( void )
28 {
29     TESTCASE( tolower( 'A' ) == 'a' );
30     TESTCASE( tolower( 'Z' ) == 'z' );
31     TESTCASE( tolower( 'a' ) == 'a' );
32     TESTCASE( tolower( 'z' ) == 'z' );
33     TESTCASE( tolower( '@' ) == '@' );
34     TESTCASE( tolower( '[' ) == '[' );
35     return TEST_RESULTS;
36 }
37 #endif