/* 
 * sigint.c 
 * 
 * Example on how to catch a CTRL^C (SIGINT) signal.  The program
 * enters an infinite loop. To terminate the program press CTRL^C.
 */

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

/* CTRL^C handler */
static void on_sigint(int signo)
{
	printf("CTRL^C pressed!\n");
	exit(0);
}

int main(void)
{
	signal(SIGINT, &on_sigint);   /* catch CTRL^C */

	while(1);  /* infinite loop */
}
