This grew a bit from last time ...
The basic change to allow dumping the environment is the same, except
I enabled this for Windows (and checked that it does in fact work --
Windows has environment variables, who knew?)
The second patch fixes a problem I noticed while testing the above on
Windows.
The third & fourth patches escape debug strings similarly to C
strings, so for example if a debug string contains '\n' then it will
be printed with ...\n... and not (as currently) break the debug
message across multiple lines. Other non-printable characters are
handled in the obvious way too.
Rich.