Catch Two Signals


The following program shows how to use the signal system call to establish a signal handler that handles two signals: SIGINT, which corresponds to typing CTRL-C at the terminal, and SIGQUIT, which corresponds to CTRL-\.

The program also demonstrates the pause system call, which suspends the program until a signal is delivered that either terminates the process or causes the invocation of a signal-catching function.

The complete source code and Makefile is available as a zip file.

catch-two.c