meta,
C++
#ifndef signals_cpp__
#define signals_cpp__
/* Module >> signals.cpp
*****************************************************************************
Authors GRT
*/
#include for_all.h
#include <signal.h>
/* pure: */ void __cdecl OurSignalHandler
// -----------------------------------------------------------------------------
(
int s // the signal )
{
signal( s, SIG_IGN ); switch ( s )
{
case SIGABRT : errno = EN_abnormal_termination ;
Case SIGFPE : errno = EN_floating_point_error ;
Case SIGILL : errno = EN_illegal_instruction ;
Case SIGSEGV : errno = EN_segmentation_violation ; // signal 11 Case SIGTERM : errno = EN_Ctrl_C_pressed ;
Else : errno = EN_unknown_signal ;
}
//
fprintf( stderr, "\nerrno = %i, signal = %i\n", errno, s );
exit( errno );
}
# endif