]> pd.if.org Git - pdclib/blob - functions/ctype/isxdigit.c
e0b0f60b2ffafa2f0e219197ba1c8441d19b9c61
[pdclib] / functions / ctype / isxdigit.c
1 /* $Id$ */
2
3 /* isxdigit( 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 #include <_PDCLIB_locale.h>
13
14 int isxdigit( int c )
15 {
16     return ( _PDCLIB_threadlocale()->_CType[c].flags & _PDCLIB_CTYPE_XDIGT );
17 }
18
19 #endif
20
21 #ifdef TEST
22 #include <_PDCLIB_test.h>
23
24 int main( void )
25 {
26     TESTCASE( isxdigit( '0' ) );
27     TESTCASE( isxdigit( '9' ) );
28     TESTCASE( isxdigit( 'a' ) );
29     TESTCASE( isxdigit( 'f' ) );
30     TESTCASE( ! isxdigit( 'g' ) );
31     TESTCASE( isxdigit( 'A' ) );
32     TESTCASE( isxdigit( 'F' ) );
33     TESTCASE( ! isxdigit( 'G' ) );
34     TESTCASE( ! isxdigit( '@' ) );
35     TESTCASE( ! isxdigit( ' ' ) );
36     return TEST_RESULTS;
37 }
38
39 #endif