summaryrefslogtreecommitdiffstats
path: root/contrib/libio/ioperror.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/libio/ioperror.c')
-rw-r--r--contrib/libio/ioperror.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/contrib/libio/ioperror.c b/contrib/libio/ioperror.c
new file mode 100644
index 0000000..7ca72b0
--- /dev/null
+++ b/contrib/libio/ioperror.c
@@ -0,0 +1,22 @@
+#include "libioP.h"
+#include <errno.h>
+#include <string.h>
+#ifndef errno
+extern int errno;
+#endif
+
+#ifndef _IO_strerror
+extern char* _IO_strerror __P((int));
+#endif
+
+void
+_IO_perror (s)
+ const char *s;
+{
+ char *error = _IO_strerror (errno);
+
+ if (s != NULL && *s != '\0')
+ _IO_fprintf (_IO_stderr, "%s:", s);
+
+ _IO_fprintf (_IO_stderr, "%s\n", error ? error : "");
+}
OpenPOWER on IntegriCloud