1 
2 #include <igraph.h>
3 #include <stdio.h>
4 
5 igraph_fatal_handler_t hanlder;
6 
handler(const char * reason,const char * file,int line)7 void handler(const char *reason, const char *file, int line) {
8     printf("Reason: %s\nFile: %s\nLine: %d\n", reason, file, line);
9     exit(0); /* We use exit(0) instead of abort() to allow the test to succeed. */
10 }
11 
main()12 int main() {
13     igraph_set_fatal_handler(&handler);
14 
15     igraph_fatal("REASON", "FILENAME", 123);
16 
17     /* The igraph_fatal() call must not return, so the following lines should not run. */
18 
19     printf("This should not be printed.");
20 
21     return 0;
22 }
23