]> pd.if.org Git - pdclib/blobdiff - functions/string/strerror.c
Whitespace cleanups.
[pdclib] / functions / string / strerror.c
index 89ebed03581a0c533f398ce339172e530b0cf1d8..59747f1d8491dc48b934dc398c2968d9f7f75500 100644 (file)
@@ -1,5 +1,3 @@
-/* $Id$ */
-
 /* strerror( int )
 
    This file is part of the Public Domain C Library (PDCLib).
 
 #ifndef REGTEST
 
+#include <locale.h>
+
 /* TODO: Doing this via a static array is not the way to do it. */
 char * strerror( int errnum )
 {
-    return (char *)_PDCLIB_errno_texts[ errnum ];
+    if ( errnum == 0 || errnum >= _PDCLIB_ERRNO_MAX )
+    {
+        return (char *)"Unknown error";
+    }
+    else
+    {
+        return _PDCLIB_lconv._PDCLIB_errno_texts[errnum];
+    }
 }
 
 #endif
 
 #ifdef TEST
-#include <_PDCLIB_test.h>
+
+#include "_PDCLIB_test.h"
 
 #include <stdio.h>
 #include <errno.h>
@@ -29,4 +37,5 @@ int main( void )
     TESTCASE( strerror( ERANGE ) != strerror( EDOM ) );
     return TEST_RESULTS;
 }
+
 #endif