]> pd.if.org Git - pdclib/blobdiff - functions/signal.c
Merged PDPCLIB and Therx code.
[pdclib] / functions / signal.c
index 33535f81ce36095914c6f13c213662b80d11f872..d0fc8b60a027d1827130adbadf58c63f0afac920 100644 (file)
@@ -5,5 +5,63 @@
 // This code is Public Domain. Use, modify, and redistribute at will.
 // ----------------------------------------------------------------------------
 
+/* PDPC code - unreviewed
+static void (*handlers[6])(int) = {
+    __sigdfl,
+    __sigdfl,
+    __sigdfl,
+    __sigdfl,
+    __sigdfl,
+    __sigdfl };
+
+void __sigdfl(int sig)
+{
+    handlers[sig] = SIG_DFL;
+    if (sig == SIGABRT)
+    {
+        exit(EXIT_FAILURE);
+    }
+    return;
+}
+
+void __sigerr(int sig)
+{
+    (void)sig;
+    return;
+}
+
+void __sigign(int sig)
+{
+    (void)sig;
+    return;
+}
+
+#define SIG_DFL __sigdfl
+#define SIG_ERR __sigerr
+#define SIG_IGN __sigign
+
+#define SIGABRT 1
+#define SIGFPE 2
+#define SIGILL 3
+#define SIGINT 4
+#define SIGSEGV 5
+#define SIGTERM 6
+*/
+
 int raise( int sig ) { /* TODO */ };
+
+/* PDPC code - unreviewed
+{
+    (handlers[sig])(sig);
+    return (0);
+}
+*/
+
 void ( * signal( int sig, void ( *func )( int ) ) ) ( int ) { /* TODO */ };
+
+/* PDPC code - unreviewed
+{
+    handlers[sig] = func;
+    return (func);
+}    
+*/