Fix a shedload of warnings, some memory leaks and clean up WARNS and lint. This is now WARNS=9, std=c99 clean on i386.
Fix a shedload of warnings, some memory leaks and clean up WARNS
and lint. This is now WARNS=9, std=c99 clean on i386.

jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase