Make functions and variables static. Remove global variables in favour of local ones. Fix indentation of a couple of switch statements.
Make functions and variables static.
Remove global variables in favour of local ones.
Fix indentation of a couple of switch statements.

Overall, this program badly need cleaning up, as it relies
on information passed around through global variables.

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