]> pd.if.org Git - pdclib/commitdiff
Initial checkin.
authorsolar <unknown>
Fri, 23 Dec 2005 15:53:08 +0000 (15:53 +0000)
committersolar <unknown>
Fri, 23 Dec 2005 15:53:08 +0000 (15:53 +0000)
functions/stdlib/abort.c [new file with mode: 0644]

diff --git a/functions/stdlib/abort.c b/functions/stdlib/abort.c
new file mode 100644 (file)
index 0000000..4a15bf8
--- /dev/null
@@ -0,0 +1,44 @@
+/* $Id$ */
+
+/* Release $Name$ */
+
+/* abort()
+
+   This file is part of the Public Domain C Library (PDCLib).
+   Permission is granted to use, modify, and / or redistribute at will.
+*/
+
+#include <stdlib.h>
+#include <signal.h>
+
+#ifndef REGTEST
+
+void abort()
+{
+    raise( SIGABRT );
+    exit( 1 );
+}
+
+#endif
+
+#ifdef TEST
+#include <_PDCLIB_test.h>
+
+#include <stdio.h>
+
+static void aborthandler( int signal )
+{
+    exit( 0 );
+}
+
+int main()
+{
+    int UNEXPECTED_RETURN_FROM_ABORT = 0;
+    BEGIN_TESTS;
+    TESTCASE( signal( SIGABRT, &aborthandler ) != SIG_ERR );
+    abort();
+    TESTCASE( UNEXPECTED_RETURN_FROM_ABORT );
+    return TEST_RESULTS;
+}
+
+#endif