X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=functions%2Fctype%2Fispunct.c;fp=functions%2Fctype%2Fispunct.c;h=2859efc32478cc35574d41eebb58ad564ff4e427;hb=f55a1b46c818376556332a6475c0b70a7539fd68;hp=0000000000000000000000000000000000000000;hpb=ad9db5af1af0576b1ac057e35917c08ece7411ba;p=fw%2Fpdclib diff --git a/functions/ctype/ispunct.c b/functions/ctype/ispunct.c new file mode 100644 index 0000000..2859efc --- /dev/null +++ b/functions/ctype/ispunct.c @@ -0,0 +1,37 @@ +/* $Id$ */ + +/* ispunct( int ) + + This file is part of the Public Domain C Library (PDCLib). + Permission is granted to use, modify, and / or redistribute at will. +*/ + +#include + +#ifndef REGTEST + +int ispunct( int c ) +{ + return ( _PDCLIB_locale_info.ctype[c].flags & _PDCLIB_CTYPE_PUNCT ); +} + +#endif + +#ifdef TEST +#include <_PDCLIB_test.h> + +int main( void ) +{ + TESTCASE( ! ispunct( 'a' ) ); + TESTCASE( ! ispunct( 'z' ) ); + TESTCASE( ! ispunct( 'A' ) ); + TESTCASE( ! ispunct( 'Z' ) ); + TESTCASE( ispunct( '@' ) ); + TESTCASE( ispunct( '.' ) ); + TESTCASE( ! ispunct( '\t' ) ); + TESTCASE( ! ispunct( '\0' ) ); + TESTCASE( ! ispunct( ' ' ) ); + return TEST_RESULTS; +} + +#endif