]> pd.if.org Git - pdclib/blobdiff - functions/stdio/perror.c
Ad-hoc solutions for perror() and strerror().
[pdclib] / functions / stdio / perror.c
index c59ca0b290a582934f50c3b4a467002915a4a527..609562a8e46a783a89420808117163d6d8ce5c5e 100644 (file)
 
 #ifndef REGTEST
 
+#include <errno.h>
+
+/* TODO: Doing this via a static array is not the way to do it. */
 void perror( const char * s )
 {
-    /* TODO: Implement. */
+    if ( ( s != NULL ) && ( s[0] != '\n' ) )
+    {
+        fprintf( stderr, "%s: ", s );
+    }
+    fprintf( stderr, "%s\n", _PDCLIB_errno_texts[ errno ] );
     return;
 }