X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=functions%2Fstdlib%2Fabort.c;h=4a15bf898c84f90b9b3e3a83add230f9aa20fc65;hb=bf5c2e9fac630d11f6232ff7fd90d3060065b53a;hp=5f18565ffa98224d38a14937b749e056a3d1a892;hpb=0a5395faab237ba9008352b0f4bee9659bbd3d5f;p=pdclib diff --git a/functions/stdlib/abort.c b/functions/stdlib/abort.c index 5f18565..4a15bf8 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() + + 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() +{ + 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