implement psignal and psiginfo
authorRich Felker <dalias@aerifal.cx>
Wed, 8 Jun 2011 20:41:44 +0000 (16:41 -0400)
committerRich Felker <dalias@aerifal.cx>
Wed, 8 Jun 2011 20:41:44 +0000 (16:41 -0400)
src/signal/psiginfo.c [new file with mode: 0644]
src/signal/psignal.c [new file with mode: 0644]

diff --git a/src/signal/psiginfo.c b/src/signal/psiginfo.c
new file mode 100644 (file)
index 0000000..fa46d2b
--- /dev/null
@@ -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 (file)
index 0000000..02f1c76
--- /dev/null
@@ -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);
+}