]> pd.if.org Git - pdclib/blob - functions/ctype/tolower.c
Getting closer to scan().
[pdclib] / 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 int tolower( int c )
14 {
15     if ( ( c >= 'A' ) && ( c <= 'Z' ) )
16     {
17         c += ( 'a' - 'A' );
18     }
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