Skip to content

Instantly share code, notes, and snippets.

@kunigami
Last active March 4, 2020 23:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kunigami/c3099e49e5a673b4276bee400a1bc2c4 to your computer and use it in GitHub Desktop.
Save kunigami/c3099e49e5a673b4276bee400a1bc2c4 to your computer and use it in GitHub Desktop.
void sigint_handler(int sig) {
write(0, "Ahhh! SIGINT!\n", 14);
}
int main(void) {
void sigint_handler(int sig); /* prototype */
struct sigaction sa;
sa.sa_handler = sigint_handler;
sa.sa_flags = 0;
sigemptyset(&sa.sa_mask);
sigaction(SIGINT, &sa, NULL);
...
}
@kunigami
Copy link
Author

kunigami commented Mar 4, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment