Get it to build and run.

Several fixes to get things running with a "modern" C compiler such as gcc2.