summaryrefslogtreecommitdiff
path: root/src/stdio/perror.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/stdio/perror.c')
-rw-r--r--src/stdio/perror.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/stdio/perror.c b/src/stdio/perror.c
new file mode 100644
index 00000000..2aae8470
--- /dev/null
+++ b/src/stdio/perror.c
@@ -0,0 +1,29 @@
+#include <stdio.h>
+#include "string.h"
+#include "errno.h"
+
+/** print an error message **/
+void perror(const char *s)
+{
+ if (s != NULL && *s != '\0') {
+ fprintf(stderr, "%s: ", s);
+ }
+ fprintf(stderr, "%s\n", strerror(errno));
+}
+
+/***
+writes an error message to IDENTIFIER(stderr).
+
+If ARGUMENT(s) is CONSTANT(NULL), the error message is a string representation of the
+current value of IDENTIFIER(errno).
+
+If ARGUMENT(s) is not CONSTANT(NULL), the error message will be preceded by the string
+pointed to by ARGUMENT(s), a colon (CHAR(:)), and a space.
+***/
+
+/*
+POSIX_(L_C_MESSAGES)
+*/
+/*
+STDC(1)
+*/