X-Git-Url: https://pd.if.org/git/?p=pdclib;a=blobdiff_plain;f=functions%2Fstring%2Fstrerror.c;fp=functions%2Fstring%2Fstrerror.c;h=89ebed03581a0c533f398ce339172e530b0cf1d8;hp=0000000000000000000000000000000000000000;hb=4116251e9bb6c386580d71d8c4afd2d0d08c6096;hpb=1353fd26a568d3145525a26e516b13089f249545 diff --git a/functions/string/strerror.c b/functions/string/strerror.c new file mode 100644 index 0000000..89ebed0 --- /dev/null +++ b/functions/string/strerror.c @@ -0,0 +1,32 @@ +/* $Id$ */ + +/* strerror( 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 + +/* TODO: Doing this via a static array is not the way to do it. */ +char * strerror( int errnum ) +{ + return (char *)_PDCLIB_errno_texts[ errnum ]; +} + +#endif + +#ifdef TEST +#include <_PDCLIB_test.h> + +#include +#include + +int main( void ) +{ + TESTCASE( strerror( ERANGE ) != strerror( EDOM ) ); + return TEST_RESULTS; +} +#endif