/*------------------------------------------------------------------*/ /* testsignalignore.c */ /* Author: Bob Dondero */ /* Ignoring signals. */ /*------------------------------------------------------------------*/ #define _GNU_SOURCE #include #include #include int main(int argc, char *argv[]) { void (*pfRet)(int); pfRet = signal(SIGINT, SIG_IGN); if (pfRet == SIG_ERR) {perror(argv[0]); return EXIT_FAILURE; } for (;;) ; /* Never should reach this point. */ } /*------------------------------------------------------------------*/ /* Sample execution: $ gcc -Wall -ansi -pedantic testsignalignore.c -o testsignalignore $ testsignalignore ^C^C^C */ /* Note: Can use kill command or Ctrl-\ to stop process. */