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