Index: fusl/src/stdio/perror.c |
diff --git a/fusl/src/stdio/perror.c b/fusl/src/stdio/perror.c |
new file mode 100644 |
index 0000000000000000000000000000000000000000..fdcb4d71c8855201c8a67858e8fa607fff038744 |
--- /dev/null |
+++ b/fusl/src/stdio/perror.c |
@@ -0,0 +1,22 @@ |
+#include <stdio.h> |
+#include <string.h> |
+#include <errno.h> |
+#include "stdio_impl.h" |
+ |
+void perror(const char *msg) |
+{ |
+ FILE *f = stderr; |
+ char *errstr = strerror(errno); |
+ |
+ FLOCK(f); |
+ |
+ if (msg && *msg) { |
+ fwrite(msg, strlen(msg), 1, f); |
+ fputc(':', f); |
+ fputc(' ', f); |
+ } |
+ fwrite(errstr, strlen(errstr), 1, f); |
+ fputc('\n', f); |
+ |
+ FUNLOCK(f); |
+} |