]> pd.if.org Git - pdclib/blob - functions/ctype/isspace.c
Getting closer to scan().
[pdclib] / functions / ctype / isspace.c
1 /* $Id$ */
2
3 /* isspace( 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 #include <stdbool.h>
11
12 #ifndef REGTEST
13
14 int isspace( int c )
15 {
16     switch ( c )
17     {
18         case ' ':
19         case '\f':
20         case '\n':
21         case '\r':
22         case '\t':
23         case '\v':
24             return true;
25         default:
26             return false;
27     }
28 }
29
30 #endif
31
32 #ifdef TEST
33 #include <_PDCLIB_test.h>
34
35 int main( void )
36 {
37     TESTCASE( isspace( ' ' ) );
38     TESTCASE( isspace( '\f' ) );
39     TESTCASE( isspace( '\n' ) );
40     TESTCASE( isspace( '\r' ) );
41     TESTCASE( isspace( '\t' ) );
42     TESTCASE( isspace( '\v' ) );
43     TESTCASE( ! isspace( 'a' ) );
44     return TEST_RESULTS;
45 }
46
47 #endif