C:/Users/Dennis/src/lang/russell.orig/src/lib/catch.c

Go to the documentation of this file.
00001 # include <signal.h>
00002 # include "mesg.h"
00003 
00004 /*
00005  *  Catch signals and flush io buffers before aborting.
00006  */
00007 
00008 int sig;           /* the signal caught */
00009 
00010 /*
00011  * catchsigs()
00012  *
00013  * Setup signals to be caught
00014  */
00015 catchsigs()
00016 {   extern int catch();
00017 
00018     signal(SIGQUIT, catch);
00019     signal(SIGILL, catch);
00020     signal(SIGEMT, catch);
00021     signal(SIGFPE, catch);
00022     signal(SIGBUS, catch);
00023     signal(SIGSEGV, catch);
00024     signal(SIGSYS, catch);
00025     signal(SIGPIPE, catch);
00026     signal(SIGALRM, catch);
00027 }
00028 
00029 /*
00030  * catch()
00031  *
00032  * Catch a signal, put it in sig, print an error message, then abort().
00033  * (Note: abort() will flush all io buffers before executing an iot trap).
00034  */
00035 catch(i)
00036 int i;
00037 {
00038     sig = i;
00039         printf("Rc failed with signal: %s\n", mesg[i]);
00040     abort();
00041 }

Generated on Fri Jan 25 10:39:46 2008 for russell by  doxygen 1.5.4