#include #include #include #include /** * Handle a big failure: segmentation fault or abort signal by simply * printing out the email address to complain with */ void failure_handler(int sig) { string error; if (sig == SIGSEGV) error = "Segmentation fault"; else if (sig == SIGABRT) error = "Abort signal"; else error = "Unknown"; cerr << "The program crashed due to some internal error (" << error << ")\n"; cerr << "Please report the error message to maintainer@mantain \n"; exit(1); } /****************************************************************************** * Main function ******************************************************************************/ int main(void) { // register the internal error handelrs signal(SIGABRT, &failure_handler); signal(SIGSEGV, &failure_handler); // try out assert(0); return 0; }