// Aaron Linville
// aaron@linville.org
// http://www.linville.org

// sigcatch.c - Example of how to install a signal handler catch a SIGINT

#include <signal.h>
#include <stdio.h>
#include <stdlib.h>

void sigproc(void);

int main(int argc, char *argv[]) {  
  /* Install a new signal handler */
  signal(SIGINT, (void *) sigproc);

  /* Do nothing forever */
  while(1 != 2);

  return 0;
}

/* Function that is called when signal is caught */
void sigproc(void) {
  printf("Caught SIGINT! Exiting.\n");

  exit(0);
}
