]> pd.if.org Git - pdclib/blob - functions/stdlib/abort.c
Initial checkin.
[pdclib] / functions / stdlib / abort.c
1 /* $Id$ */
2
3 /* Release $Name$ */
4
5 /* abort()
6
7    This file is part of the Public Domain C Library (PDCLib).
8    Permission is granted to use, modify, and / or redistribute at will.
9 */
10
11 #include <stdlib.h>
12 #include <signal.h>
13
14 #ifndef REGTEST
15
16 void abort()
17 {
18     raise( SIGABRT );
19     exit( 1 );
20 }
21
22 #endif
23
24 #ifdef TEST
25 #include <_PDCLIB_test.h>
26
27 #include <stdio.h>
28
29 static void aborthandler( int signal )
30 {
31     exit( 0 );
32 }
33
34 int main()
35 {
36     int UNEXPECTED_RETURN_FROM_ABORT = 0;
37     BEGIN_TESTS;
38     TESTCASE( signal( SIGABRT, &aborthandler ) != SIG_ERR );
39     abort();
40     TESTCASE( UNEXPECTED_RETURN_FROM_ABORT );
41     return TEST_RESULTS;
42 }
43
44 #endif