--- a/UnixOperatingSystem.st Fri Jan 19 16:02:37 2007 +0100
+++ b/UnixOperatingSystem.st Mon Jan 22 16:41:18 2007 +0100
@@ -475,22 +475,6 @@
#endif
/*
- * not all systems have time_t and off_t
- * explicit add of those we know to have ...
- */
-#ifdef __osf__
-# define TIME_T time_t
-# define OFF_T off_t
-#endif
-
-#ifndef TIME_T
-# define TIME_T long
-#endif
-#ifndef OFF_T
-# define OFF_T long
-#endif
-
-/*
* where is the timezone info ?
*/
#ifdef HAS_TM_GMTOFF
@@ -3318,34 +3302,34 @@
|path f fExt commandFilename|
- commandFilename := aCommand asFilename.
+ commandFilename := aCommand asFilename.
commandFilename isAbsolute ifTrue:[
- ^ aCommand
+ ^ aCommand
].
commandFilename isExplicitRelative ifTrue:[
- ^ commandFilename pathName
+ ^ commandFilename pathName
].
path := self getEnvironment:'PATH'.
path notNil ifTrue:[
- (path asCollectionOfSubstringsSeparatedBy:(self pathSeparator)) do:[:path |
- path isEmpty ifTrue:[
- f := aCommand asFilename
- ] ifFalse:[
- f := path asFilename construct:aCommand.
- ].
- self executableFileExtensions do:[:ext |
- ext notEmpty ifTrue:[
- fExt := (f pathName , ext) asFilename.
- ] ifFalse:[
- fExt := f.
- ].
- fExt isExecutable ifTrue:[
- ^ fExt pathName
- ].
- ].
- ].
+ (path asCollectionOfSubstringsSeparatedBy:(self pathSeparator)) do:[:path |
+ path isEmpty ifTrue:[
+ f := aCommand asFilename
+ ] ifFalse:[
+ f := path asFilename construct:aCommand.
+ ].
+ self executableFileExtensions do:[:ext |
+ ext notEmpty ifTrue:[
+ fExt := (f pathName , ext) asFilename.
+ ] ifFalse:[
+ fExt := f.
+ ].
+ fExt isExecutable ifTrue:[
+ ^ fExt pathName
+ ].
+ ].
+ ].
].
^ nil
@@ -5944,8 +5928,8 @@
int fds[2];
if (socketpair(AF_UNIX, SOCK_STREAM, 0, fds) == -1) {
- @global(LastErrorNumber) = __mkSmallInteger(errno);
- RETURN ( nil );
+ @global(LastErrorNumber) = __mkSmallInteger(errno);
+ RETURN ( nil );
}
fd1 = __mkSmallInteger(fds[0]);
@@ -5953,7 +5937,7 @@
#endif
%}.
fd1 notNil ifTrue:[
- ^ Array with:fd1 with:fd2.
+ ^ Array with:fd1 with:fd2.
].
^ nil
!
@@ -6224,8 +6208,8 @@
%{
#ifndef NO_SOCKET
if (__isSmallInteger(fileDescriptor)) {
- shutdown(__smallIntegerVal(fileDescriptor), 1);
- RETURN(self);
+ shutdown(__smallIntegerVal(fileDescriptor), 1);
+ RETURN(self);
}
#endif
%}.
@@ -6310,30 +6294,30 @@
int valueSize;
if (__isStringLike(aKeyStringOrSymbol)) {
- if (aString == nil) {
- /* env used only temporary for deregistration */
- valueSize = 0;
- env = __stringVal(aKeyStringOrSymbol);
- } else if (__isStringLike(aString)) {
- /* have to use stable memory for env */
- valueSize = __stringSize(aString);
- env = (char *)malloc(__stringSize(aKeyStringOrSymbol) + valueSize + 2);
- if (env == 0)
- goto err;
- strcpy(env, __stringVal(aKeyStringOrSymbol));
- strcat(env, "=");
- strncat(env, __stringVal(aString), valueSize);
- } else
- goto err;
-
- if (putenv(env) == 0) {
- RETURN(self);
- }
-
- if (valueSize > 0) {
- /* could not register, free */
- free(env);
- }
+ if (aString == nil) {
+ /* env used only temporary for deregistration */
+ valueSize = 0;
+ env = __stringVal(aKeyStringOrSymbol);
+ } else if (__isStringLike(aString)) {
+ /* have to use stable memory for env */
+ valueSize = __stringSize(aString);
+ env = (char *)malloc(__stringSize(aKeyStringOrSymbol) + valueSize + 2);
+ if (env == 0)
+ goto err;
+ strcpy(env, __stringVal(aKeyStringOrSymbol));
+ strcat(env, "=");
+ strncat(env, __stringVal(aString), valueSize);
+ } else
+ goto err;
+
+ if (putenv(env) == 0) {
+ RETURN(self);
+ }
+
+ if (valueSize > 0) {
+ /* could not register, free */
+ free(env);
+ }
err:;
}
%}.
@@ -6730,8 +6714,8 @@
getNetworkAddresses
"return a dictionary filled with
- key -> name of interface
- value -> the socket adress of the interface
+ key -> name of interface
+ value -> the socket adress of the interface
for each interface"
|addressArray nameArray noOfIf retDictionary error|
@@ -6755,8 +6739,8 @@
afinet_socket = socket(AF_INET, SOCK_DGRAM, 0);
if (afinet_socket < 0) {
- error = __MKSTRING("Cannot open socket");
- goto bad;
+ error = __MKSTRING("Cannot open socket");
+ goto bad;
}
/*
@@ -6767,9 +6751,9 @@
ifc.ifc_buf = (caddr_t) buf;
if (ioctl (afinet_socket, SIOCGIFCONF, (caddr_t) &ifc) < 0) {
- close(afinet_socket);
- error = __MKSTRING("ioctl(SIOCGIFCONF) failed");
- goto bad;
+ close(afinet_socket);
+ error = __MKSTRING("ioctl(SIOCGIFCONF) failed");
+ goto bad;
}
n_ifs = ifc.ifc_len / sizeof (struct ifreq);
@@ -6778,9 +6762,9 @@
addressArray = __MKARRAY(n_ifs);
if (nameArray == nil || addressArray == nil) {
- /* Creating a string wouldn/t work here */
- error = @symbol(allocationFailure);
- goto bad;
+ /* Creating a string wouldn/t work here */
+ error = @symbol(allocationFailure);
+ goto bad;
}
/*
@@ -6791,28 +6775,28 @@
countOfIf = 0;
for (i=0, ifr = ifc.ifc_req; i < n_ifs; i++, ifr++) {
- /*
- ** Get Flags for this interface
- */
-
- memcpy(&ifreq, ifr, sizeof(ifreq));
- /*
- ** Get address for this interface
- */
- memcpy(&ifreq, ifr, sizeof(ifreq));
- if (ioctl (afinet_socket, SIOCGIFADDR, &ifreq) >= 0) {
- t = __MKBYTEARRAY((char *)&ifreq.ifr_addr, sizeof(ifreq.ifr_addr));
- __arrayVal(addressArray)[countOfIf] = t; __STORE(addressArray, t);
- t = __MKSTRING(&ifreq.ifr_name, IFNAMSIZ);
- __arrayVal(nameArray)[countOfIf] = t; __STORE(nameArray, t);
- countOfIf += 1;
- }
+ /*
+ ** Get Flags for this interface
+ */
+
+ memcpy(&ifreq, ifr, sizeof(ifreq));
+ /*
+ ** Get address for this interface
+ */
+ memcpy(&ifreq, ifr, sizeof(ifreq));
+ if (ioctl (afinet_socket, SIOCGIFADDR, &ifreq) >= 0) {
+ t = __MKBYTEARRAY((char *)&ifreq.ifr_addr, sizeof(ifreq.ifr_addr));
+ __arrayVal(addressArray)[countOfIf] = t; __STORE(addressArray, t);
+ t = __MKSTRING(&ifreq.ifr_name, IFNAMSIZ);
+ __arrayVal(nameArray)[countOfIf] = t; __STORE(nameArray, t);
+ countOfIf += 1;
+ }
}
noOfIf = __mkSmallInteger(countOfIf);
bad:
if (afinet_socket >= 0)
- close(afinet_socket);
+ close(afinet_socket);
#else
error = @symbol(notSupported);
#endif /* defined(SIOCGIFADDR) */
@@ -6820,13 +6804,13 @@
retDictionary := Dictionary new:noOfIf.
error notNil ifTrue:[
- self primitiveFailed:error.
- "return empty dictionary if proceed from error"
- ^ retDictionary.
+ self primitiveFailed:error.
+ "return empty dictionary if proceed from error"
+ ^ retDictionary.
].
1 to:noOfIf do:[:cnt|
- retDictionary at:(nameArray at:cnt) put:(SocketAddress fromBytes:(addressArray at:cnt)).
+ retDictionary at:(nameArray at:cnt) put:(SocketAddress fromBytes:(addressArray at:cnt)).
].
^ retDictionary
@@ -6838,8 +6822,8 @@
getNetworkMACAddresses
"return a dictionary filled with
- key -> name of interface
- value -> the MAC adress (as ByteArray)
+ key -> name of interface
+ value -> the MAC adress (as ByteArray)
for each interface"
|addressArray nameArray noOfIf retDictionary error|
@@ -6863,8 +6847,8 @@
afinet_socket = socket(AF_INET, SOCK_DGRAM, 0);
if (afinet_socket < 0) {
- error = __MKSTRING("Cannot open socket");
- goto bad;
+ error = __MKSTRING("Cannot open socket");
+ goto bad;
}
/*
@@ -6875,9 +6859,9 @@
ifc.ifc_buf = (caddr_t) buf;
if (ioctl (afinet_socket, SIOCGIFCONF, (caddr_t) &ifc) < 0) {
- close(afinet_socket);
- error = __MKSTRING("ioctl(SIOCGIFCONF) failed");
- goto bad;
+ close(afinet_socket);
+ error = __MKSTRING("ioctl(SIOCGIFCONF) failed");
+ goto bad;
}
n_ifs = ifc.ifc_len / sizeof (struct ifreq);
@@ -6886,9 +6870,9 @@
addressArray = __MKARRAY(n_ifs);
if (nameArray == nil || addressArray == nil) {
- /* Creating a string wouldn/t work here */
- error = @symbol(allocationFailure);
- goto bad;
+ /* Creating a string wouldn/t work here */
+ error = @symbol(allocationFailure);
+ goto bad;
}
/*
@@ -6899,32 +6883,32 @@
countOfIf = 0;
for (i=0, ifr = ifc.ifc_req; i < n_ifs; i++, ifr++) {
- /*
- ** Get Flags for this interface
- */
-
- memcpy(&ifreq, ifr, sizeof(ifreq));
- if (ioctl (afinet_socket, SIOCGIFFLAGS, &ifreq) < 0) {
- fprintf(stderr, "ioctl(SIOCGIFFLAGS) failed");
- } else {
- /*
- ** Get Hardware address for this interface
- */
- memcpy(&ifreq, ifr, sizeof(ifreq));
- if (ioctl (afinet_socket, SIOCGIFHWADDR, &ifreq) >= 0) {
- t = __MKBYTEARRAY(&ifreq.ifr_hwaddr.sa_data, IFHWADDRLEN);
- __arrayVal(addressArray)[countOfIf] = t; __STORE(addressArray, t);
- t = __MKSTRING(&ifreq.ifr_name, IFNAMSIZ);
- __arrayVal(nameArray)[countOfIf] = t; __STORE(nameArray, t);
- countOfIf += 1;
- }
- }
+ /*
+ ** Get Flags for this interface
+ */
+
+ memcpy(&ifreq, ifr, sizeof(ifreq));
+ if (ioctl (afinet_socket, SIOCGIFFLAGS, &ifreq) < 0) {
+ fprintf(stderr, "ioctl(SIOCGIFFLAGS) failed");
+ } else {
+ /*
+ ** Get Hardware address for this interface
+ */
+ memcpy(&ifreq, ifr, sizeof(ifreq));
+ if (ioctl (afinet_socket, SIOCGIFHWADDR, &ifreq) >= 0) {
+ t = __MKBYTEARRAY(&ifreq.ifr_hwaddr.sa_data, IFHWADDRLEN);
+ __arrayVal(addressArray)[countOfIf] = t; __STORE(addressArray, t);
+ t = __MKSTRING(&ifreq.ifr_name, IFNAMSIZ);
+ __arrayVal(nameArray)[countOfIf] = t; __STORE(nameArray, t);
+ countOfIf += 1;
+ }
+ }
}
noOfIf = __mkSmallInteger(countOfIf);
bad:
if (afinet_socket >= 0)
- close(afinet_socket);
+ close(afinet_socket);
#else
error = @symbol(notSupported);
#endif /* SIOCGIFHWADDR */
@@ -6932,13 +6916,13 @@
retDictionary := Dictionary new:noOfIf.
error notNil ifTrue:[
- self primitiveFailed:error.
- "return empty dictionary if proceed from error"
- ^ retDictionary.
+ self primitiveFailed:error.
+ "return empty dictionary if proceed from error"
+ ^ retDictionary.
].
1 to:noOfIf do:[:cnt|
- retDictionary at:(nameArray at:cnt) put:(addressArray at:cnt).
+ retDictionary at:(nameArray at:cnt) put:(addressArray at:cnt).
].
^ retDictionary
@@ -8265,31 +8249,31 @@
%{
struct tm tm;
- TIME_T t;
+ time_t t;
if (__bothSmallInteger(y, m)
&& __bothSmallInteger(d, h)
&& __bothSmallInteger(min, s)) {
- tm.tm_hour = __intVal(h);
- tm.tm_min = __intVal(min);
- tm.tm_sec = __intVal(s);
-
- tm.tm_year = __intVal(y) - 1900;
- tm.tm_mon = __intVal(m) - 1;
- tm.tm_mday = __intVal(d);
- tm.tm_isdst = -1;
-
- t = mktime(&tm); /* mktime() interprets tm as localtime */
- if ((INT)t != -1) {
- if (utcBoolean == true) { /* convert to utc time */
- t = (INT)t - TIMEZONE(&tm); /* TIMZONE = seconds westward from 0 */
- }
- osSeconds = __MKINT((INT)t); /* be careful, t can be negative at the start of the epoch ! */
- }
+ tm.tm_hour = __intVal(h);
+ tm.tm_min = __intVal(min);
+ tm.tm_sec = __intVal(s);
+
+ tm.tm_year = __intVal(y) - 1900;
+ tm.tm_mon = __intVal(m) - 1;
+ tm.tm_mday = __intVal(d);
+ tm.tm_isdst = -1;
+
+ t = mktime(&tm); /* mktime() interprets tm as localtime */
+ if ((INT)t != -1) {
+ if (utcBoolean == true) { /* convert to utc time */
+ t = (INT)t - TIMEZONE(&tm); /* TIMZONE = seconds westward from 0 */
+ }
+ osSeconds = __MKINT((INT)t); /* be careful, t can be negative at the start of the epoch ! */
+ }
}
%}.
osSeconds notNil ifTrue:[
- ^ osSeconds * 1000 + millis
+ ^ osSeconds * 1000 + millis
].
^ self primitiveFailed
@@ -8646,34 +8630,31 @@
%{
struct tm tmValue;
- INT t;
- TIME_T tt;
-
- t = __longIntVal(osSeconds);
+ time_t tt;
+
+ tt = __longIntVal(osSeconds);
/* try cache */
{
- OBJ lastSeconds, lastTimeInfo;
-
- lastSeconds = @global(LastTimeInfoSeconds);
- if (lastSeconds
- && (__longIntVal(lastSeconds) == t)
- && (@global(LastTimeInfoMilliseconds) == osMilliseconds)
- && (@global(LastTimeInfoIsLocal) == isLocalTime)
- ) {
- lastTimeInfo = @global(LastTimeInfo);
- if (lastTimeInfo != nil) {
- RETURN (lastTimeInfo);
- }
- }
- }
-
- tt = (TIME_T)t;
+ OBJ lastSeconds, lastTimeInfo;
+
+ lastSeconds = @global(LastTimeInfoSeconds);
+ if (lastSeconds
+ && (__longIntVal(lastSeconds) == tt)
+ && (@global(LastTimeInfoMilliseconds) == osMilliseconds)
+ && (@global(LastTimeInfoIsLocal) == isLocalTime)
+ ) {
+ lastTimeInfo = @global(LastTimeInfo);
+ if (lastTimeInfo != nil) {
+ RETURN (lastTimeInfo);
+ }
+ }
+ }
if (isLocalTime == true) {
- localtime_r(&tt, &tmValue);
+ localtime_r(&tt, &tmValue);
} else {
- gmtime_r(&tt, &tmValue);
+ gmtime_r(&tt, &tmValue);
}
hours = __mkSmallInteger(tmValue.tm_hour);
minutes = __mkSmallInteger(tmValue.tm_min);
@@ -8690,17 +8671,17 @@
%}.
info := self timeInfoClass new.
info
- year:year
- month:month
- day:day
- hours:hours
- minutes:minutes
- seconds:seconds
- milliseconds:osMilliseconds
- utcOffset:utcOffset
- dst:dst
- dayInYear:yDay
- dayInWeek:wDay.
+ year:year
+ month:month
+ day:day
+ hours:hours
+ minutes:minutes
+ seconds:seconds
+ milliseconds:osMilliseconds
+ utcOffset:utcOffset
+ dst:dst
+ dayInYear:yDay
+ dayInWeek:wDay.
%{
@global(LastTimeInfo) = info; __GSTORE(info);
@@ -11458,20 +11439,20 @@
int nInstBytes, sockAddrSize;
if (wantHostName == true) {
- hp = host;
- hsz = sizeof(host);
+ hp = host;
+ hsz = sizeof(host);
}
if (wantServiceName == true) {
- sp = service;
- ssz = sizeof(service);
+ sp = service;
+ ssz = sizeof(service);
}
if (hp == 0 && sp == 0) {
- error = @symbol(badArgument);
- goto err;
+ error = @symbol(badArgument);
+ goto err;
}
if (!__isBytes(socketAddress)) {
- error = @symbol(badArgument1);
- goto err;
+ error = @symbol(badArgument1);
+ goto err;
}
nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(__qClass(socketAddress))->c_ninstvars));
@@ -11479,183 +11460,183 @@
sockAddrSize -= nInstBytes;
if (!__isSmallInteger(flags)) {
- error = @symbol(badArgument5);
- goto err;
+ error = @symbol(badArgument5);
+ goto err;
}
__flags = __intVal(flags);
#if defined(NI_NUMERICHOST)
if (useDatagram == true) {
- __flags |= NI_DGRAM;
+ __flags |= NI_DGRAM;
}
{
- bp = (char *)(__byteArrayVal(socketAddress));
- bp += nInstBytes;
- __BEGIN_INTERRUPTABLE__
- ret = getnameinfo((struct sockaddr *)bp, sockAddrSize,
- hp, hsz, sp, ssz, __flags);
- __END_INTERRUPTABLE__
+ bp = (char *)(__byteArrayVal(socketAddress));
+ bp += nInstBytes;
+ __BEGIN_INTERRUPTABLE__
+ ret = getnameinfo((struct sockaddr *)bp, sockAddrSize,
+ hp, hsz, sp, ssz, __flags);
+ __END_INTERRUPTABLE__
} while (ret == EAI_SYSTEM && errno == EINTR);
if (ret != 0) {
- switch (ret) {
- case EAI_FAMILY:
- error = @symbol(badProtocol);
- break;
- case EAI_SOCKTYPE:
- error = @symbol(badSocketType);
- break;
- case EAI_BADFLAGS:
- error = @symbol(badFlags);
- break;
- case EAI_NONAME:
- error = @symbol(unknownHost);
- break;
- case EAI_SERVICE:
- error = @symbol(unknownService);
- break;
- case EAI_ADDRFAMILY :
- error = @symbol(unknownHostForProtocol);
- break;
- case EAI_NODATA:
- error = @symbol(noAddress);
- break;
- case EAI_MEMORY:
- error = @symbol(allocationFailure);
- break;
- case EAI_FAIL:
- error = @symbol(permanentFailure);
- break;
- case EAI_AGAIN:
- error = @symbol(tryAgain);
- break;
- case EAI_SYSTEM:
- error = @symbol(systemError);
- break;
- default:
- error = @symbol(unknownError);
- }
- errorString = __MKSTRING(gai_strerror(ret));
- goto err;
+ switch (ret) {
+ case EAI_FAMILY:
+ error = @symbol(badProtocol);
+ break;
+ case EAI_SOCKTYPE:
+ error = @symbol(badSocketType);
+ break;
+ case EAI_BADFLAGS:
+ error = @symbol(badFlags);
+ break;
+ case EAI_NONAME:
+ error = @symbol(unknownHost);
+ break;
+ case EAI_SERVICE:
+ error = @symbol(unknownService);
+ break;
+ case EAI_ADDRFAMILY :
+ error = @symbol(unknownHostForProtocol);
+ break;
+ case EAI_NODATA:
+ error = @symbol(noAddress);
+ break;
+ case EAI_MEMORY:
+ error = @symbol(allocationFailure);
+ break;
+ case EAI_FAIL:
+ error = @symbol(permanentFailure);
+ break;
+ case EAI_AGAIN:
+ error = @symbol(tryAgain);
+ break;
+ case EAI_SYSTEM:
+ error = @symbol(systemError);
+ break;
+ default:
+ error = @symbol(unknownError);
+ }
+ errorString = __MKSTRING(gai_strerror(ret));
+ goto err;
}
# else /* ! NI_NUMERICHOST */
{
- /*
- * Do it using gethostbyaddr()
- */
- struct sockaddr_in *sa;
-
- if (sockAddrSize < sizeof(*sa)) {
- error = @symbol(badArgument1);
- goto err;
- }
- bp = (char *)(__byteArrayVal(socketAddress));
- bp += nInstBytes;
- sa = (struct sockaddr_in *)bp;
-
- if (sp) {
- struct servent *servp;
- char *__proto = 0;
-
- __proto = (useDatagram == true ? "udp" : "tcp");
-
- servp = getservbyport(sa->sin_port, __proto);
- if (servp) {
- sp = servp->s_name;
- }
- }
- if (hp) {
- struct hostent *hostp;
+ /*
+ * Do it using gethostbyaddr()
+ */
+ struct sockaddr_in *sa;
+
+ if (sockAddrSize < sizeof(*sa)) {
+ error = @symbol(badArgument1);
+ goto err;
+ }
+ bp = (char *)(__byteArrayVal(socketAddress));
+ bp += nInstBytes;
+ sa = (struct sockaddr_in *)bp;
+
+ if (sp) {
+ struct servent *servp;
+ char *__proto = 0;
+
+ __proto = (useDatagram == true ? "udp" : "tcp");
+
+ servp = getservbyport(sa->sin_port, __proto);
+ if (servp) {
+ sp = servp->s_name;
+ }
+ }
+ if (hp) {
+ struct hostent *hostp;
# ifdef USE_H_ERRNO
- do {
- bp = (char *)(__byteArrayVal(socketAddress));
- bp += nInstBytes;
- sa = (struct sockaddr_in *)bp;
-
- /* __BEGIN_INTERRUPTABLE__ is dangerous, because gethostbyname uses a static data area
- */
- hostp = gethostbyaddr((char *)&sa->sin_addr, sockAddrSize, sa->sin_family);
- /* __END_INTERRUPTABLE__ */
- } while ((hostp == NULL)
- && ((h_errno == TRY_AGAIN)
- || errno == EINTR
+ do {
+ bp = (char *)(__byteArrayVal(socketAddress));
+ bp += nInstBytes;
+ sa = (struct sockaddr_in *)bp;
+
+ /* __BEGIN_INTERRUPTABLE__ is dangerous, because gethostbyname uses a static data area
+ */
+ hostp = gethostbyaddr((char *)&sa->sin_addr, sockAddrSize, sa->sin_family);
+ /* __END_INTERRUPTABLE__ */
+ } while ((hostp == NULL)
+ && ((h_errno == TRY_AGAIN)
+ || errno == EINTR
# ifdef IRIX5_3
- || (errno == ECONNREFUSED)
+ || (errno == ECONNREFUSED)
# endif
- )
- );
- if (hostp == 0) {
- switch (h_errno) {
- case HOST_NOT_FOUND:
- errorString = @symbol(unknownHost);
- break;
- case NO_ADDRESS:
- errorString = @symbol(noAddress);
- break;
- case NO_RECOVERY:
- errorString = @symbol(permanentFailure);
- break;
- case TRY_AGAIN:
- errorString = @symbol(tryAgain);
- break;
- default:
- errorString = @symbol(unknownError);
- break;
- }
- error = __mkSmallInteger(h_errno);
- goto err;
- }
+ )
+ );
+ if (hostp == 0) {
+ switch (h_errno) {
+ case HOST_NOT_FOUND:
+ errorString = @symbol(unknownHost);
+ break;
+ case NO_ADDRESS:
+ errorString = @symbol(noAddress);
+ break;
+ case NO_RECOVERY:
+ errorString = @symbol(permanentFailure);
+ break;
+ case TRY_AGAIN:
+ errorString = @symbol(tryAgain);
+ break;
+ default:
+ errorString = @symbol(unknownError);
+ break;
+ }
+ error = __mkSmallInteger(h_errno);
+ goto err;
+ }
# else /* !USE_H_ERRNO */
- hostp = gethostbyaddr(sa->sin_addr, sockAddrSize, sa->sin_family);
- if (hostp == 0) {
- errorString = @symbol(unknownHost);
- error = __mkSmallInteger(-1);
- goto err;
- }
+ hostp = gethostbyaddr(sa->sin_addr, sockAddrSize, sa->sin_family);
+ if (hostp == 0) {
+ errorString = @symbol(unknownHost);
+ error = __mkSmallInteger(-1);
+ goto err;
+ }
# endif /* !USE_H_ERRNO*/
- hp = hostp->h_name;
- }
+ hp = hostp->h_name;
+ }
}
# endif /* ! NI_NUMERICHOST */
if (hp)
- hostName = __MKSTRING(hp);
+ hostName = __MKSTRING(hp);
if (sp)
- serviceName = __MKSTRING(sp);
+ serviceName = __MKSTRING(sp);
err:;
#else
error = @symbol(notImplemented);
#endif
%}.
error notNil ifTrue:[
- ^ (HostAddressLookupError new
- parameter:error;
- messageText:' - ', errorString;
- request:thisContext message) raiseRequest.
+ ^ (HostAddressLookupError new
+ parameter:error;
+ messageText:' - ', errorString;
+ request:thisContext message) raiseRequest.
].
^ Array with:hostName with:serviceName
"
self getNameInfo:
- (self getAddressInfo:'localhost' serviceName:'echo'
- domain:#inet type:#stream protocol:nil flags:nil) first socketAddress
- wantHostName:true wantServiceName:true datagram:false flags:0
+ (self getAddressInfo:'localhost' serviceName:'echo'
+ domain:#inet type:#stream protocol:nil flags:nil) first socketAddress
+ wantHostName:true wantServiceName:true datagram:false flags:0
self getNameInfo:
- (self getAddressInfo:'exept.exept.de' serviceName:'echo'
- domain:#inet type:#stream protocol:nil flags:nil) first socketAddress
- wantHostName:true wantServiceName:true datagram:false flags:0
+ (self getAddressInfo:'exept.exept.de' serviceName:'echo'
+ domain:#inet type:#stream protocol:nil flags:nil) first socketAddress
+ wantHostName:true wantServiceName:true datagram:false flags:0
self getNameInfo:
- (self getAddressInfo:'217.172.183.25' serviceName:'22'
- domain:#inet type:#stream protocol:nil flags:nil) first socketAddress
- wantHostName:true wantServiceName:true datagram:false flags:0
+ (self getAddressInfo:'217.172.183.25' serviceName:'22'
+ domain:#inet type:#stream protocol:nil flags:nil) first socketAddress
+ wantHostName:true wantServiceName:true datagram:false flags:0
self getNameInfo:
- (self getAddressInfo:'1.2.3.4' serviceName:'22'
- domain:#inet type:#stream protocol:nil flags:nil) first socketAddress
- wantHostName:true wantServiceName:true datagram:false flags:0
+ (self getAddressInfo:'1.2.3.4' serviceName:'22'
+ domain:#inet type:#stream protocol:nil flags:nil) first socketAddress
+ wantHostName:true wantServiceName:true datagram:false flags:0
"
! !
@@ -12500,7 +12481,7 @@
!UnixOperatingSystem class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/UnixOperatingSystem.st,v 1.237 2007-01-09 12:49:44 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/UnixOperatingSystem.st,v 1.238 2007-01-22 15:41:18 stefan Exp $'
! !
UnixOperatingSystem initialize!