summaryrefslogtreecommitdiffstats
path: root/libsyscalls_perror.c
diff options
context:
space:
mode:
Diffstat (limited to 'libsyscalls_perror.c')
-rw-r--r--libsyscalls_perror.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/libsyscalls_perror.c b/libsyscalls_perror.c
new file mode 100644
index 0000000..4b110c7
--- /dev/null
+++ b/libsyscalls_perror.c
@@ -0,0 +1,15 @@
+/* See LICENSE file for copyright and license details. */
+#include "common.h"
+
+#include <stdio.h>
+
+
+void
+libsyscalls_perror(const char *prefix, enum libsyscalls_error error)
+{
+ const char *str = libsyscalls_strerror(error);
+ if (prefix && *prefix)
+ fprintf(stderr, "%s: %s\n", prefix, str);
+ else
+ fprintf(stderr, "%s\n", str);
+}