summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/signal/psiginfo.c10
-rw-r--r--src/signal/psignal.c10
2 files changed, 20 insertions, 0 deletions
diff --git a/src/signal/psiginfo.c b/src/signal/psiginfo.c
new file mode 100644
index 00000000..fa46d2bf
--- /dev/null
+++ b/src/signal/psiginfo.c
@@ -0,0 +1,10 @@
+#include <stdio.h>
+#include <string.h>
+#include <signal.h>
+
+void psiginfo(siginfo_t *si, const char *msg)
+{
+ char *s = strsignal(si->si_signo);
+ if (msg) fprintf(stderr, "%s: %s\n", msg, s);
+ else fprintf(stderr, "%s\n", s);
+}
diff --git a/src/signal/psignal.c b/src/signal/psignal.c
new file mode 100644
index 00000000..02f1c760
--- /dev/null
+++ b/src/signal/psignal.c
@@ -0,0 +1,10 @@
+#include <stdio.h>
+#include <string.h>
+#include <signal.h>
+
+void psignal(int sig, const char *msg)
+{
+ char *s = strsignal(sig);
+ if (msg) fprintf(stderr, "%s: %s\n", msg, s);
+ else fprintf(stderr, "%s\n", s);
+}