and some bugfixes. Approved by: re (scottl)
+ Convert to ANSI-C function definitions + style(9) Submitted by: kris