/* Purpose:  show that a process can ignore a signal.  

   Details:  the program loops for 20,000,000 iterations and 
	     displays its progress every 1,000,000 iterations.
	     If the user types control-c, it is ignored. */

#include <iostream>
using namespace std;

#include <unistd.h>
#include <signal.h>

int main(void)
{
	int i;

	/* the following line, when executed, changes entry #2	*/
	/* in the signal table.  Instead of executing the 	*/
	/* default action, the signal will be ignored. 		*/
	signal(SIGINT, SIG_IGN);	/* first statement in program */

	/* do nothing useful for 20,000,000 iterations */ 
	for (i = 1; i <= 20000000; i++)
	{
		if (i % 1000000 == 0)
		{
			printf("i = %i\n", i);
		}
	}
}


