]> pd.if.org Git - pdclib/blob - functions/string/strerror.c
PDCLib includes with quotes, not <>.
[pdclib] / functions / string / strerror.c
1 /* strerror( int )
2
3    This file is part of the Public Domain C Library (PDCLib).
4    Permission is granted to use, modify, and / or redistribute at will.
5 */
6
7 #include <string.h>
8
9 #ifndef REGTEST
10
11 #include "_PDCLIB_locale.h"
12
13 /* TODO: Doing this via a static array is not the way to do it. */
14 char * strerror( int errnum )
15 {
16     if ( errnum >= _PDCLIB_ERRNO_MAX )
17     {
18         return (char *)"Unknown error";
19     }
20     else
21     {
22         return (char *)_PDCLIB_threadlocale()->_ErrnoStr[errnum];
23     }
24 }
25
26 #endif
27
28 #ifdef TEST
29 #include "_PDCLIB_test.h"
30
31 #include <stdio.h>
32 #include <errno.h>
33
34 int main( void )
35 {
36     TESTCASE( strerror( ERANGE ) != strerror( EDOM ) );
37     return TEST_RESULTS;
38 }
39 #endif