Advertisement
rfmonk

signal_ouch.c

Jan 19th, 2014
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.30 KB | None | 0 0
  1. #include <signal.h>
  2. #include "tlpi_hdr.h"
  3.  
  4. static void
  5. sigHandler(int sig)
  6. {
  7.     printf("ouch!\n");
  8. }
  9.  
  10. int
  11. main(int argc, char *argv[])
  12. {
  13.     int j;
  14.  
  15.     if (signal(SIGINT, sigHandler) == SIG_ERR)
  16.         errExit("signal");
  17.  
  18.     for (j = 0; ; j++) {
  19.         printf("%d\n", j);
  20.         sleep(3);
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement