Move dprintf and the debug system out into misc.c, to centralise it.