warning supressions

I've compiled the code with my usual warnings enabled (and through some static analysers) on GCC and clang, and fixed up the vast majority of warnings generated.

Nothing contained in here really changes functionality; though I did separate the `system` calls out for more extensive error handling.

Valgrind still reports a few memory leaks, but I'm not quite familiar enough with some of the program structure to comment on them, and they look pretty tame for the most part.