]> pd.if.org Git - pdclib/blob - functions/ctype/ispunct.c
6c067889f5350394a80650a0e2288fc27102f457
[pdclib] / functions / ctype / ispunct.c
1 /* $Id$ */
2
3 /* ispunct( 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 ispunct( int c )
15 {
16     return ( _PDCLIB_threadlocale()->_CType[c].flags & _PDCLIB_CTYPE_PUNCT );
17 }
18
19 #endif
20
21 #ifdef TEST
22 #include <_PDCLIB_test.h>
23
24 int main( void )
25 {
26     TESTCASE( ! ispunct( 'a' ) );
27     TESTCASE( ! ispunct( 'z' ) );
28     TESTCASE( ! ispunct( 'A' ) );
29     TESTCASE( ! ispunct( 'Z' ) );
30     TESTCASE( ispunct( '@' ) );
31     TESTCASE( ispunct( '.' ) );
32     TESTCASE( ! ispunct( '\t' ) );
33     TESTCASE( ! ispunct( '\0' ) );
34     TESTCASE( ! ispunct( ' ' ) );
35     return TEST_RESULTS;
36 }
37
38 #endif