Refactor the signal-handling code out of src/main.c, and into its own so...

...urce

file (finally!).