Hi i've done this code but there are somethings i need to add like.
- ignore signal SIGINT
- restore the signal handler for SIGINT to the default one
- catch signal SIGINT and prints out the numerical value of the signal
so far this is the coding i have
void sig_handler(int signo)
{
// body of signal handler
}
int main()
{
struct sigaction act;
act.sa_flags = 0;
act.sa_handler = sig_handler;
sigfillset( & (act.sa_mask) );
if (sigaction(sig, &act, NULL) != 0)
{
perror("sigaction"); exit(1);
}
}