Replace fprintf() with debug()

and provide variable debug levels. Currently compile time option
only.
Add bsd/queue.h for TAILQ macros