projects
/
fw
/
pdclib
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Addressed ticket #40 (non-standard errno values).
[fw/pdclib]
/
functions
/
stdio
/
perror.c
diff --git
a/functions/stdio/perror.c
b/functions/stdio/perror.c
index bf3b3afee1c1bf0028218f657263853c0ffcc7a6..23ce68bd356cc11e997dcdabf4873b32156b2204 100644
(file)
--- a/
functions/stdio/perror.c
+++ b/
functions/stdio/perror.c
@@
-11,6
+11,7
@@
#ifndef REGTEST
#include <errno.h>
#ifndef REGTEST
#include <errno.h>
+#include <locale.h>
/* TODO: Doing this via a static array is not the way to do it. */
void perror( const char * s )
/* TODO: Doing this via a static array is not the way to do it. */
void perror( const char * s )
@@
-19,7
+20,14
@@
void perror( const char * s )
{
fprintf( stderr, "%s: ", 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;
}
return;
}