-/* $Id$ */
-
/* perror( const char * )
This file is part of the Public Domain C Library (PDCLib).
*/
#include <stdio.h>
+#include <errno.h>
+#include <locale.h>
#ifndef REGTEST
-#include <errno.h>
-
/* TODO: Doing this via a static array is not the way to do it. */
void perror( const char * s )
{
{
fprintf( stderr, "%s: ", s );
}
- fprintf( stderr, "%s\n", _PDCLIB_errno_texts[ errno ] );
+ if ( errno >= _PDCLIB_ERRNO_MAX )
+ {
+ fprintf( stderr, "Unknown error\n" );
+ }
+ else
+ {
+ fprintf( stderr, "%s\n", _PDCLIB_lconv._PDCLIB_errno_texts[errno] );
+ }
return;
}
#endif
#ifdef TEST
-#include <_PDCLIB_test.h>
+
+#include "_PDCLIB_test.h"
+
#include <stdlib.h>
#include <string.h>
#include <limits.h>
TESTCASE( fread( buffer, 1, 7, fh ) == 7 );
TESTCASE( memcmp( buffer, "Test: ", 6 ) == 0 );
TESTCASE( fclose( fh ) == 0 );
- remove( testfile );
+ TESTCASE( remove( testfile ) == 0 );
return TEST_RESULTS;
}