Usermode/libc - Fixed some warnings in strtoi tests
[tpg/acess2.git] / Usermode / Libraries / libc.so_src / errno.c
index af369b1..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>
@@ -42,6 +43,7 @@ EXPORT char *strerror(int errnum)
        case EADDRNOTAVAIL:     return "Address not avaliable";
        case EINPROGRESS:       return "Operation in process";
        case EPERM:     return "Operation not permitted";
+       case ENOTTY:    return "Not a TTY";
        case EAGAIN:    return "Try again";
        case EALREADY:  return "Operation was no-op";
        case EINTERNAL: return "Internal error";
@@ -61,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