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