Merge branch 'master' of git://cadel.mutabah.net/acess2
[tpg/acess2.git] / Usermode / Libraries / libc.so_src / errno.c
index a2d7890..7e1905c 100644 (file)
@@ -6,6 +6,7 @@
  * - errno and strerror
  */
 #include "lib.h"
+#include <stdio.h>
 #include <errno.h>
 #include <acess/sys.h>
 #include <string.h>
@@ -62,3 +63,16 @@ EXPORT int strerror_r(int errnum, char *buf, size_t bufsiz)
        return 0;
 }
 
+// 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