Add altos platform
[fw/pdclib] / platform / altos / functions / ctype / tolower.c
diff --git a/platform/altos/functions/ctype/tolower.c b/platform/altos/functions/ctype/tolower.c
new file mode 100644 (file)
index 0000000..44909e8
--- /dev/null
@@ -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 <ctype.h>
+
+#ifndef REGTEST
+
+#include <locale.h>
+
+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