Clean up #includes

All C and system (e.g. <stdio.h>) includes were moved to defs.h, and redundant
includes were deleted. Most files now include glob.h (which includes defs.h) to
get the necessary header includes.