Cleaned up lots of warnings. cb now compiles and runs on MacOS X

* Now builds and runs successfully on MacOS X Yosemite
* This cleans up some of the hackiness from my earlier commit; put `/*static*/` back to `static` and instead declared matching function prototypes.
* Added a bunch of `#include`-s to get rid of warnings about implicit declarations for stdlib functions
* Cleaned up most warnings
* But did not figure out why Jive doesn't work...