]> pd.if.org Git - pdclib/blob - functions/ctype/isdigit.c
762580af39edd707715c9cab7f83935798ee3f61
[pdclib] / functions / ctype / isdigit.c
1 /* isdigit( int )
2
3    This file is part of the Public Domain C Library (PDCLib).
4    Permission is granted to use, modify, and / or redistribute at will.
5 */
6
7 #include <ctype.h>
8
9 #ifndef REGTEST
10 #include <_PDCLIB_locale.h>
11
12 int isdigit( int c )
13 {
14     return ( _PDCLIB_threadlocale()->_CType[c].flags & _PDCLIB_CTYPE_DIGIT );
15 }
16
17 #endif
18
19 #ifdef TEST
20 #include <_PDCLIB_test.h>
21
22 int main( void )
23 {
24     TESTCASE( isdigit( '0' ) );
25     TESTCASE( isdigit( '9' ) );
26     TESTCASE( ! isdigit( ' ' ) );
27     TESTCASE( ! isdigit( 'a' ) );
28     TESTCASE( ! isdigit( '@' ) );
29     return TEST_RESULTS;
30 }
31
32 #endif