/*
   Demostrate UNIX Interrupt
*/

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


void Int_Handler(int dummy)
{
   static int k = 0;

   printf("Hello, I'm your firendly interrupt handler. Times called: %d\n", k);
   k++;
}


main()
{
   int i;

/*
   printf("Setting up interrupt signal for SIGINT (control-C)\n");
   sigset(SIGINT, Int_Handler);
*/
/*
*/
   printf("Setting up interrupt signal for SIGTSTP (control-Z)\n");
   sigset(SIGTSTP, Int_Handler);

   while (1)
    { for (i = 0; i < 999999; i++);
      putchar('.'); fflush(stdout);
    }
}
