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