Modify catchsignal.c to only allow user to break the program when they use Ctrl-C twice. Modify this file to allow user to break the program when they use Ctrl-C twice. */ #include

icon
Related questions
Question

Modify catchsignal.c to only allow user to break the program when they use Ctrl-C twice.

Modify this file to allow user to break the program when they use Ctrl-C twice.
*/

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

void sig_handler()
{
    printf("I got an INT signal\n");
}

 

int main(void)
{

    signal(SIGINT, sig_handler);

    int i;
        while(1){
                printf("%d\n",i);
                i++;
                sleep(1);
        }
    return 0;
}

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer