X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=functions%2Fctype%2Fisspace.c;fp=functions%2Fctype%2Fisspace.c;h=346167efc22cad6909d575bb7a6b7a3db1478ed5;hb=5bcc00c1b85feff1996e3f34a1a9ebf3b624161e;hp=0000000000000000000000000000000000000000;hpb=68525aefa7b7b1f2f769e287e1f2f3a4585005ff;p=pdclib diff --git a/functions/ctype/isspace.c b/functions/ctype/isspace.c new file mode 100644 index 0000000..346167e --- /dev/null +++ b/functions/ctype/isspace.c @@ -0,0 +1,47 @@ +/* $Id$ */ + +/* isspace( int ) + + This file is part of the Public Domain C Library (PDCLib). + Permission is granted to use, modify, and / or redistribute at will. +*/ + +#include +#include + +#ifndef REGTEST + +int isspace( int c ) +{ + switch ( c ) + { + case ' ': + case '\f': + case '\n': + case '\r': + case '\t': + case '\v': + return true; + default: + return false; + } +} + +#endif + +#ifdef TEST +#include <_PDCLIB_test.h> + +int main( void ) +{ + TESTCASE( isspace( ' ' ) ); + TESTCASE( isspace( '\f' ) ); + TESTCASE( isspace( '\n' ) ); + TESTCASE( isspace( '\r' ) ); + TESTCASE( isspace( '\t' ) ); + TESTCASE( isspace( '\v' ) ); + TESTCASE( ! isspace( 'a' ) ); + return TEST_RESULTS; +} + +#endif