== Handling UNIX signals == {{{ /* - shows how a signal handler works. * - run this and press Ctrl-C a few times */ #include #include main() { void f(int); /* declare the handler */ int i; signal( SIGINT, f ); /* install the handler */ for(i=0; i<5; i++ ){ /* do something else */ printf("hello\n"); sleep(1); } } void f(int signum) /* this function is called */ { printf("OUCH!\n"); } }}}