]> pd.if.org Git - pdclib/blob - functions/stdlib/abort.c
Porting current working set from CVS.
[pdclib] / functions / stdlib / abort.c
1 /* $Id$ */
2
3 /* Release $Name$ */
4
5 /* abort( void )
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( void )
17 {
18     raise( SIGABRT );
19     exit( EXIT_FAILURE );
20 }
21
22 #endif
23
24 #ifdef TEST
25 #include <_PDCLIB_test.h>
26
27 #include <stdio.h>
28
29 static void aborthandler( int sig )
30 {
31     exit( 0 );
32 }
33
34 int main( void )
35 {
36     int UNEXPECTED_RETURN_FROM_ABORT = 0;
37     TESTCASE( signal( SIGABRT, &aborthandler ) != SIG_ERR );
38     abort();
39     TESTCASE( UNEXPECTED_RETURN_FROM_ABORT );
40     return TEST_RESULTS;
41 }
42
43 #endif