Usermode/libc - Moved perror to errno.c and implimented it properly
[tpg/acess2.git] / Usermode / Libraries / libc.so_src / errno.c
index 9877328..b4a4f01 100644 (file)
@@ -6,6 +6,7 @@
  * - errno and strerror
  */
 #include "lib.h"
+#include <stdio.h>
 #include <errno.h>
 #include <acess/sys.h>
 
@@ -28,3 +29,16 @@ EXPORT const char *strerror(int errnum)
        }
 }
 
+// stdio.h
+EXPORT void perror(const char *s)
+{
+       int err = errno;
+       if( s && s[0] ) {
+               fprintf(stderr, "%s: (%i) %s\n", s, err, strerror(err));
+       }
+       else {
+               fprintf(stderr, "(%i) %s\n", err, strerror(err));
+       }
+       _SysDebug("perror('%s'): %s (%i)", s, strerror(err), err);
+}
+

UCC git Repository :: git.ucc.asn.au