- len = wxStrlen(environment);
-#if !defined(SVR4) || defined(__sgi)
-#if wxUSE_UNICODE
- (void)gethostname(hostbuf, 1024 - len);
-#else
- (void)gethostname(environment + len, 1024 - len);
-#endif
-#else
-#if wxUSE_UNICODE
- (void)sysinfo(SI_HOSTNAME, hostbuf, 1024 - len);
-#else
- (void)sysinfo(SI_HOSTNAME, environment + len, 1024 - len);
-#endif
-#endif
-#if wxUSE_UNICODE
- wxStrcat(environment, wxConv_libc.cMB2WX(hostbuf));
-#endif
+ size_t len = wxStrlen(environment);
+
+ wxChar hostbuf[1024];
+ (void)wxGetHostName(hostbuf, WXSIZEOF(hostbuf) - len);
+
+ wxStrcat(environment, hostbuf);