X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=functions%2Fstdlib%2Fabort.c;h=13d92de6a5de4a26c03f19d5a24768244de3d00d;hb=cd6cfe0f578c4f744ddc9a342243aff6b42f8027;hp=5f18565ffa98224d38a14937b749e056a3d1a892;hpb=e5456e3c2697c4e17fc9aa3439f2e305517b4d96;p=pdclib.old diff --git a/functions/stdlib/abort.c b/functions/stdlib/abort.c index 5f18565..13d92de 100644 --- a/functions/stdlib/abort.c +++ b/functions/stdlib/abort.c @@ -1,15 +1,41 @@ -// ---------------------------------------------------------------------------- -// $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 */ }; +/* abort( void ) -/* PDPC code - unreviewed + 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); + raise( SIGABRT ); + exit( EXIT_FAILURE ); } -*/ \ No newline at end of file + +#endif + +#ifdef TEST +#include <_PDCLIB_test.h> + +#include + +static void aborthandler( int sig ) +{ + exit( 0 ); +} + +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