-int main ( int argc, char **argv ) {
-#if _MSC_VER
- // Windows has no $HOME aka %HOME%, so we have to construct the full path.
- // make sure it fits into the buffer. Max. path length is 255, but who knows
- // what's in these environment variables?
- homepath[sizeof(homepath)-1] = 0;
- strncpy( homepath, ::getenv("APPDATA"), sizeof(homepath)-1 );
- strncat( homepath, "\\flightgear.org", sizeof(homepath)-strlen(homepath)-1 );
+int main ( int argc, char **argv )
+{
+#if defined(_MSC_VER) || defined(_WIN32)
+ // Don't show blocking "no disk in drive" error messages on Windows 7,
+ // silently return errors to application instead.
+ // See Microsoft MSDN #ms680621: "GUI apps should specify SEM_NOOPENFILEERRORBOX"
+ SetErrorMode(SEM_NOOPENFILEERRORBOX);
+
+ hostname = ::getenv( "COMPUTERNAME" );
+#else
+ // Unix(alike) systems
+ char _hostname[256];
+ gethostname(_hostname, 256);
+ hostname = _hostname;
+
+ signal(SIGPIPE, SIG_IGN);