Fixed a segfault due to fprintf being called with an uninitialized file ...

...pointer.

        Renamed global diagnostics file pointer from fd to diag_fd.
        Changed explicit fprintf calls to warnx calls.