Category : Files from Magazines
Archive   : CGAZV5N5.ZIP
Filename : LIST5.C

 
Output of file : LIST5.C contained in archive : CGAZV5N5.ZIP
/*---------------------------------------- Listing 5 ------
* Demonstration of calling one handler from another.
* See Listing 1 for copyright terms.
*-------------------------------------------------------*/
#include
#include

void FpeHandler ( int Signal, int SubCode );
void main ( void );

void FpeHandler ( int Signal, int SubCode )
{
/*---------------------------------------------------------
* Microsoft C work around to keep handler from recursive
* re-entry. After enjoying the crash (MSC only) ,
* turn on the following line:
*-------------------------------------------------------*/

#ifdef WATCH_MSC_CRASH
signal(SIGFPE, SIG_IGN);
#endif
_fpreset();
printf( "Signal %d, SubCode %d was raised\n",
Signal, SubCode );
raise ( SIGFPE );

/*---------------------------------------------------------
* For demonstration purposes, SIGFPE was explicitly raised
* within the handler. Therefore, the following line is
* NEVER reached
*-------------------------------------------------------*/

#ifdef WATCH_MSC_CRASH
signal(SIGFPE, FpeHandler);
#endif
}

void main ( void )
{
void (*OldHandler) ( int Signal );
float Bill, Gates;

Bill = Gates;

OldHandler = signal ( SIGFPE, FpeHandler );
if ( OldHandler == SIG_ERR )
printf ( "signal failed\n" );

raise ( SIGFPE );
}

  3 Responses to “Category : Files from Magazines
Archive   : CGAZV5N5.ZIP
Filename : LIST5.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/