3 /* perror( const char * )
5 This file is part of the Public Domain C Library (PDCLib).
6 Permission is granted to use, modify, and / or redistribute at will.
15 /* TODO: Doing this via a static array is not the way to do it. */
16 void perror( const char * s )
18 if ( ( s != NULL ) && ( s[0] != '\n' ) )
20 fprintf( stderr, "%s: ", s );
22 fprintf( stderr, "%s\n", _PDCLIB_errno_texts[ errno ] );
29 #include <_PDCLIB_test.h>
37 unsigned long long max = ULLONG_MAX;
39 sprintf( buffer, "%llu", max );
40 TESTCASE( ( fh = freopen( testfile, "wb+", stderr ) ) != NULL );
41 TESTCASE( strtol( buffer, NULL, 10 ) == LONG_MAX );
44 TESTCASE( fread( buffer, 1, 7, fh ) == 7 );
45 TESTCASE( memcmp( buffer, "Test: ", 6 ) == 0 );
46 TESTCASE( fclose( fh ) == 0 );
47 TESTCASE( remove( testfile ) == 0 );