]> pd.if.org Git - pdclib/blob - functions/stdlib/abort.c
Whitespace cleanups.
[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
22 #include "_PDCLIB_test.h"
23
24 #include <stdio.h>
25
26 static void aborthandler( int sig )
27 {
28     exit( 0 );
29 }
30
31 int main( void )
32 {
33     int UNEXPECTED_RETURN_FROM_ABORT = 0;
34     TESTCASE( signal( SIGABRT, &aborthandler ) != SIG_ERR );
35     abort();
36     TESTCASE( UNEXPECTED_RETURN_FROM_ABORT );
37     return TEST_RESULTS;
38 }
39
40 #endif