This program is careful to restore the original terminal modes before
exiting or terminating with a signal. It uses the atexit
function (see Cleanups on Exit) to make sure this is done
by exit.

The shell is supposed to take care of resetting the terminal modes when
a process is stopped or continued; see Job Control. But some
existing shells do not actually do this, so you may wish to establish
handlers for job control signals that reset terminal modes. The above
example does so.