void catchctrlc(int signo) { char handmsg[] = "I found Ctrl-C\n"; int msglen = sizeof(handmsg); write(STDERR_FILENO, handmsg, msglen); }
struct sigaction act;
newact.sa_handler = SIG_DFL; /* new handler set to default */ newact.sa_flags = 0; /* no special options */ if ((sigemptyset(&newact.sa_mask) == -1) || (sigaction(SIGINT, &newact, NULL) == -1)) perror("Failed to set SIGINT to the default action");