+bool wxGetHostName(char *buf, int sz)
+{
+ bool ok = wxGetHostNameInternal(buf, sz);
+
+ if ( ok )
+ {
+ // BSD systems return the FQDN, we only want the hostname, so extract
+ // it (we consider that dots are domain separators)
+ char *dot = strchr(buf, '.');
+ if ( dot )
+ {
+ // nuke it
+ *dot = '\0';
+ }
+ }
+
+ return ok;
+}
+
+bool wxGetFullHostName(char *buf, int sz)
+{
+ bool ok = wxGetHostNameInternal(buf, sz);
+
+ if ( ok )
+ {
+ if ( !strchr(buf, '.') )
+ {
+ struct hostent *host = gethostbyname(buf);
+ if ( !host )
+ {
+ wxLogSysError(_("Cannot get the official hostname"));
+
+ ok = FALSE;
+ }
+ else
+ {
+ // the canonical name
+ strncpy(buf, host->h_name, sz);
+ }
+ }
+ //else: it's already a FQDN (BSD behaves this way)
+ }
+
+ return ok;
+}
+