--- a/Win32OperatingSystem.st Tue Dec 14 17:45:15 2004 +0100
+++ b/Win32OperatingSystem.st Wed Dec 15 11:27:54 2004 +0100
@@ -5195,7 +5195,7 @@
name isNil ifTrue:[
"/ sometimes, we can extract the domainName from the hostName ...
- hostName := self getHostName.
+ hostName := self primGetHostName.
hostName notNil ifTrue:[
idx := hostName indexOf:$..
idx ~~ 0 ifTrue:[
@@ -5245,7 +5245,8 @@
^ name
"
- DomainName := nil. OperatingSystem getDomainName
+ DomainName := nil.
+ OperatingSystem getDomainName
OperatingSystem getHostName
"
@@ -5286,17 +5287,13 @@
"
!
-getHostName
+primGetHostName
"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."
- |name idx|
-
- HostName notNil ifTrue:[
- ^ HostName
- ].
+ |name|
%{ /* STACK: 2048 */
#if defined(HAS_GETHOSTNAME)
@@ -5318,19 +5315,42 @@
name := self getEnvironment:'HOST'.
name isNil ifTrue:[
name := self getEnvironment:'HOSTNAME'.
+ name isNil ifTrue:[
+ name := self getEnvironment:'COMPUTERNAME'.
+ name isNil ifTrue:[
+ 'Win32OperatingSystem [warning]: cannot find out hostname' errorPrintCR.
+ name := 'unknown'.
+ ]
+ ]
]
].
- name isNil ifTrue:[
- 'Win32OperatingSystem [warning]: cannot find out hostname' errorPrintCR.
- name := 'unknown'.
- ] ifFalse:[
- "/ on some systems, the hostname already contains the domain.
- "/ decompose it here.
- idx := name indexOf:$..
- idx ~~ 0 ifTrue:[
- DomainName := name copyFrom:(idx+1).
- name := name copyTo:(idx-1).
- ]
+ ^ name
+
+ "
+ OperatingSystem primGetHostName
+ "
+!
+
+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."
+
+ |name idx|
+
+ HostName notNil ifTrue:[
+ ^ HostName
+ ].
+
+ name := self primGetHostName.
+
+ "/ on some systems, the hostname already contains the domain.
+ "/ decompose it here.
+ idx := name indexOf:$..
+ idx ~~ 0 ifTrue:[
+ DomainName := name copyFrom:(idx+1).
+ name := name copyTo:(idx-1).
].
HostName := name.
^ name
@@ -7274,7 +7294,7 @@
Portable applications may want to check the systemType and NOT depend
on all keys to be present in the returned dictionary."
- |info name uid gid dir|
+ |info name "uid gid" dir|
info := IdentityDictionary new.
name isNil ifTrue:[
@@ -9187,7 +9207,7 @@
!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.168 2004-11-30 16:40:02 ca Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.169 2004-12-15 10:27:54 penk Exp $'
! !
!Win32OperatingSystem::Win32FILEHandle methodsFor:'release'!
@@ -9214,7 +9234,7 @@
!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.168 2004-11-30 16:40:02 ca Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.169 2004-12-15 10:27:54 penk Exp $'
! !
!Win32OperatingSystem::Win32Handle methodsFor:'io'!
@@ -9599,7 +9619,7 @@
!Win32OperatingSystem class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.168 2004-11-30 16:40:02 ca Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.169 2004-12-15 10:27:54 penk Exp $'
! !
Win32OperatingSystem initialize!