X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=functions%2Fstdlib%2Fabort.c;h=b7f09777cd3923a82ace7f8a8135239efbb5dca4;hb=e25ac2ecee6251afcec84e08165e454fb6bc256c;hp=5f18565ffa98224d38a14937b749e056a3d1a892;hpb=0a5395faab237ba9008352b0f4bee9659bbd3d5f;p=pdclib diff --git a/functions/stdlib/abort.c b/functions/stdlib/abort.c index 5f18565..b7f0977 100644 --- a/functions/stdlib/abort.c +++ b/functions/stdlib/abort.c @@ -1,15 +1,44 @@ -// ---------------------------------------------------------------------------- -// $Id$ -// ---------------------------------------------------------------------------- -// Public Domain C Library - http://pdclib.sourceforge.net -// This code is Public Domain. Use, modify, and redistribute at will. -// ---------------------------------------------------------------------------- +/* $Id$ */ -void abort( void ) { /* TODO */ }; +/* Release $Name$ */ -/* PDPC code - unreviewed +/* abort( void ) + + This file is part of the Public Domain C Library (PDCLib). + Permission is granted to use, modify, and / or redistribute at will. +*/ + +#include +#include + +#ifndef REGTEST + +void abort( void ) +{ + raise( SIGABRT ); + exit( 1 ); +} + +#endif + +#ifdef TEST +#include <_PDCLIB_test.h> + +#include + +static void aborthandler( int signal ) { - raise(SIGABRT); - exit(EXIT_FAILURE); + exit( 0 ); } -*/ \ No newline at end of file + +int main() +{ + int UNEXPECTED_RETURN_FROM_ABORT = 0; + BEGIN_TESTS; + TESTCASE( signal( SIGABRT, &aborthandler ) != SIG_ERR ); + abort(); + TESTCASE( UNEXPECTED_RETURN_FROM_ABORT ); + return TEST_RESULTS; +} + +#endif