Change function definition from K&R to prototype. Fix prototype warnings.