[ok] Ctrl-C works correctly, HUP too. No hangs.

Correct way to handle signals.
Tested on linux (debian).
Removed debug about done installing signal handler
fix a few NULL dereference errors
more static analysis
more warning fixes
using ot_term now, and more warning fixes
rebase complete, bug-fixes for handler on win