X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=functions%2Fstdlib%2Fabort.c;h=c5adfbd744ee0f21e5f24e2ac60cbc032fab65fb;hb=12e17136786afb1775c9dc946cbe41f5e230c24a;hp=5f18565ffa98224d38a14937b749e056a3d1a892;hpb=e5456e3c2697c4e17fc9aa3439f2e305517b4d96;p=pdclib.old diff --git a/functions/stdlib/abort.c b/functions/stdlib/abort.c index 5f18565..c5adfbd 100644 --- a/functions/stdlib/abort.c +++ b/functions/stdlib/abort.c @@ -1,15 +1,43 @@ -// ---------------------------------------------------------------------------- -// $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( EXIT_FAILURE ); +} + +#endif + +#ifdef TEST +#include <_PDCLIB_test.h> + +#include + +static void aborthandler( int sig ) { - raise(SIGABRT); - exit(EXIT_FAILURE); + exit( 0 ); } -*/ \ No newline at end of file + +int main( void ) +{ + int UNEXPECTED_RETURN_FROM_ABORT = 0; + TESTCASE( signal( SIGABRT, &aborthandler ) != SIG_ERR ); + abort(); + TESTCASE( UNEXPECTED_RETURN_FROM_ABORT ); + return TEST_RESULTS; +} + +#endif