]> pd.if.org Git - pdclib/blob - functions/string/strerror.c
89ebed03581a0c533f398ce339172e530b0cf1d8
[pdclib] / functions / string / strerror.c
1 /* $Id$ */
2
3 /* strerror( 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 <string.h>
10
11 #ifndef REGTEST
12
13 /* TODO: Doing this via a static array is not the way to do it. */
14 char * strerror( int errnum )
15 {
16     return (char *)_PDCLIB_errno_texts[ errnum ];
17 }
18
19 #endif
20
21 #ifdef TEST
22 #include <_PDCLIB_test.h>
23
24 #include <stdio.h>
25 #include <errno.h>
26
27 int main( void )
28 {
29     TESTCASE( strerror( ERANGE ) != strerror( EDOM ) );
30     return TEST_RESULTS;
31 }
32 #endif