X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=functions%2Fstdlib%2Fabort.c;h=1847771262a72e8e6a26e2580bc21b9c646d48c7;hb=b1fc26afebd4d557ff89a44bc21767a8704c3809;hp=1665706c391ee04fdbfe3b48bd09473f5ebc0765;hpb=1d9d92ba957a0b8307c9a65c35867fde68e6533b;p=pdclib diff --git a/functions/stdlib/abort.c b/functions/stdlib/abort.c index 1665706..1847771 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. +*/ + +#include +#include -/* PDPC code - unreviewed +#ifndef REGTEST + +void abort( void ) { - raise(SIGABRT); - exit(EXIT_FAILURE); + raise( SIGABRT ); + exit( EXIT_FAILURE ); } -*/ + +#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