/*------------------------------------------------------------------*/ /* testsignal.c */ /* The signal() function. */ /* Author: Bob Dondero */ /*------------------------------------------------------------------*/ #define _GNU_SOURCE #include #include #include /*------------------------------------------------------------------*/ static void myHandler(int iSig) /* This function is intended to be a handler for signals of various types. Print iSig to stdout. */ { printf("In myHandler with argument %d\n", iSig); } /*------------------------------------------------------------------*/ int main(void) /* Illustrate the signal() function. */ { void (*pfRet)(int); pfRet = signal(SIGINT, myHandler); assert(pfRet != SIG_ERR); printf("Entering an infinite loop\n"); for (;;) ; return 0; }