Made errhandle.h, Replaced more printf() with debug()

errhandle.h contains a number of macros borrowed by Zed Shaw to handle
debugging, error handling and logging.

Commonly used macros are debug, log_* and check