Fix compiler warnings.
Add skip routine for sequential fgets calls.
Change tmpnam calls to mkstemp