X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=platform%2Faltos%2Ffunctions%2Fctype%2Ftolower.c;fp=platform%2Faltos%2Ffunctions%2Fctype%2Ftolower.c;h=44909e85efe703adcc2e0f18eabb4680fe7d3202;hb=d58957de3e0b9b7076a6f5dd49d5df8e78f5a826;hp=0000000000000000000000000000000000000000;hpb=6225e295ec21ab2e47ab4cd153921221bc05a2b0;p=fw%2Fpdclib diff --git a/platform/altos/functions/ctype/tolower.c b/platform/altos/functions/ctype/tolower.c new file mode 100644 index 0000000..44909e8 --- /dev/null +++ b/platform/altos/functions/ctype/tolower.c @@ -0,0 +1,37 @@ +/* $Id$ */ + +/* tolower( int ) + + This file is part of the Public Domain C Library (PDCLib). + Permission is granted to use, modify, and / or redistribute at will. +*/ + +#include + +#ifndef REGTEST + +#include + +int tolower( int c ) +{ + if ('A' <= c && c <= 'Z') + c = c + 'a' - 'A'; + return c; +} + +#endif + +#ifdef TEST +#include <_PDCLIB_test.h> + +int main( void ) +{ + TESTCASE( tolower( 'A' ) == 'a' ); + TESTCASE( tolower( 'Z' ) == 'z' ); + TESTCASE( tolower( 'a' ) == 'a' ); + TESTCASE( tolower( 'z' ) == 'z' ); + TESTCASE( tolower( '@' ) == '@' ); + TESTCASE( tolower( '[' ) == '[' ); + return TEST_RESULTS; +} +#endif