--- a/UnixOperatingSystem.st Sun Aug 01 12:11:07 2010 +0100
+++ b/UnixOperatingSystem.st Tue Aug 10 09:55:15 2010 +0100
@@ -6481,43 +6481,32 @@
!
getHostName
- "return the hostname we are running on - if there is
- a HOST environment variable, we are much faster here ...
- Notice:
- not all systems support this; on some, 'unknown' is returned."
-
- |hostName idx shouldCacheHostName|
+ "return the hostname we are running on.
+ The host name returned is fully qualified - if returned so by the system."
+
+ |hostName|
HostName notNil ifTrue:[
- ^ HostName
- ].
-
- shouldCacheHostName := false.
+ ^ HostName
+ ].
+
hostName := self primGetHostName.
hostName isNil ifTrue:[
- "fallBack - in non-antique systes we never come here"
- hostName := self getEnvironment:'HOST'.
- hostName isNil ifTrue:[
- hostName := self getCommandOutputFrom:'/bin/hostname'
- ].
- hostName isNil ifTrue:[
- 'UnixOperatingSystem [warning]: cannot find out hostname' errorPrintCR.
- hostName := 'unknown'.
- ].
- shouldCacheHostName := true.
- ].
-
- "on some systems, the host already contains the domain.
- decompose it here."
- idx := hostName indexOf:$..
- idx ~~ 0 ifTrue:[
- hostName := hostName copyTo:(idx-1).
- ].
- shouldCacheHostName ifTrue:[
- "only cache, if hostname fetching is expensive, otherwise we want to see a changed hostname"
- HostName := hostName.
- ].
+ "fallBack - in non-antique systes we never come here"
+ hostName := self getEnvironment:'HOST'.
+ hostName isNil ifTrue:[
+ hostName := self getCommandOutputFrom:'/bin/hostname'
+ ].
+ hostName isNil ifTrue:[
+ 'UnixOperatingSystem [warning]: cannot find out hostname' errorPrintCR.
+ hostName := 'unknown'.
+ ].
+ "cache, only because hostname fetching was expensive,
+ otherwise we want to see a changed hostname"
+ HostName := hostName.
+ ].
+
^ hostName
"
@@ -7188,7 +7177,7 @@
rel = __MKSTRING(ubuff.release);
ver = __MKSTRING(ubuff.version);
mach = __MKSTRING(ubuff.machine);
-# ifdef HAS_UTS_DOMAINNAME
+# if defined(HAS_UTS_DOMAINNAME) || defined(_GNU_SOURCE)
dom = __MKSTRING(ubuff.domainname);
# endif /* no HAS_UTS_DOMAINNAME */
}
@@ -7243,16 +7232,6 @@
# endif /* SI_RELEASE */
#endif /* HAS_SYSINFO */
-#if defined(HAS_GETDOMAINNAME)
- if (dom == nil) {
- char buffer[128];
-
- if (getdomainname(buffer, sizeof(buffer)) == 0) {
- dom = __MKSTRING(buffer);
- }
- }
-#endif /* HAS_GETDOMAINNAME */
-
#if defined(HAS_SYSCONF)
# ifdef _SC_NPROCESSORS_ONLN
{
@@ -7759,21 +7738,21 @@
%{
# ifdef NEXT
-# define SYS_STRING "next"
+# define SYS_SYMBOL @symbol(next)
# endif
# ifdef IRIS
-# define SYS_STRING "iris"
+# define SYS_SYMBOL @symbol(iris)
# endif
-# ifdef SYS_STRING
- sys = __MKSTRING(SYS_STRING);
-# undef SYS_STRING
+# ifdef SYS_SYMBOL
+ sys = SYS_SYMBOL;
+# undef SYS_SYMBOL
# endif
%}.
sys isNil ifTrue:[
- ^ self getOSType
+ ^ self getOSType
].
^ sys
@@ -11287,7 +11266,7 @@
serviceName := serviceNameArg printString. "convert integer port numbers"
].
-%{ /* STACK: 100000 */ /* Don't know whether DNS, NIS, LDAP or whatever is consulted */
+%{ /* STACK: 200000 */ /* Don't know whether DNS, NIS, LDAP or whatever is consulted */
#undef xxAI_NUMERICHOST /* remove xx to test gethost...() path */
@@ -12721,15 +12700,15 @@
!UnixOperatingSystem class methodsFor:'documentation'!
version
- ^ '$Id: UnixOperatingSystem.st 10544 2010-07-12 16:20:36Z vranyj1 $'
+ ^ '$Id: UnixOperatingSystem.st 10564 2010-08-10 08:55:15Z vranyj1 $'
!
version_CVS
- ^ 'Header: /cvs/stx/stx/libbasic/UnixOperatingSystem.st,v 1.274 2010/04/12 18:37:20 stefan Exp '
+ ^ 'Header: /cvs/stx/stx/libbasic/UnixOperatingSystem.st,v 1.276 2010/07/27 09:08:07 stefan Exp '
!
version_SVN
- ^ '$Id: UnixOperatingSystem.st 10544 2010-07-12 16:20:36Z vranyj1 $'
+ ^ '$Id: UnixOperatingSystem.st 10564 2010-08-10 08:55:15Z vranyj1 $'
! !
UnixOperatingSystem initialize!
@@ -12738,3 +12717,4 @@
+