]> pd.if.org Git - pdclib/blobdiff - functions/ctype/isalpha.c
ctype
[pdclib] / functions / ctype / isalpha.c
diff --git a/functions/ctype/isalpha.c b/functions/ctype/isalpha.c
new file mode 100644 (file)
index 0000000..2bde755
--- /dev/null
@@ -0,0 +1,33 @@
+/* $Id$ */
+
+/* isalpha( 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
+
+int isalpha( int c )
+{
+    return ( _PDCLIB_locale_info.ctype[c].flags & _PDCLIB_CTYPE_ALPHA );
+}
+
+#endif
+
+#ifdef TEST
+#include <_PDCLIB_test.h>
+
+int main( void )
+{
+    TESTCASE( isalpha( 'a' ) );
+    TESTCASE( isalpha( 'z' ) );
+    TESTCASE( ! isalpha( ' ' ) );
+    TESTCASE( ! isalpha( '1' ) );
+    TESTCASE( ! isalpha( '@' ) );
+    return TEST_RESULTS;
+}
+
+#endif