summaryrefslogtreecommitdiff
path: root/sig_catch.c
diff options
context:
space:
mode:
Diffstat (limited to 'sig_catch.c')
-rw-r--r--sig_catch.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/sig_catch.c b/sig_catch.c
new file mode 100644
index 0000000..1888765
--- /dev/null
+++ b/sig_catch.c
@@ -0,0 +1,18 @@
+#include <signal.h>
+#include "sig.h"
+#include "hassgact.h"
+
+void sig_catch(sig,f)
+int sig;
+void (*f)();
+{
+#ifdef HASSIGACTION
+ struct sigaction sa;
+ sa.sa_handler = f;
+ sa.sa_flags = 0;
+ sigemptyset(&sa.sa_mask);
+ sigaction(sig,&sa,(struct sigaction *) 0);
+#else
+ signal(sig,f); /* won't work under System V, even nowadays---dorks */
+#endif
+}