mirror of
https://github.com/gnustep/libs-base.git
synced 2025-06-01 17:12:03 +00:00
fix OSX specific file to not build elsewhere
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@30223 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
97bc275de1
commit
80eecd3f50
3 changed files with 72 additions and 58 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
2010-04-23 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* Source/Additions/NSFileHandle+GNUstepBase.m: fix to only build on OSX
|
||||||
|
|
||||||
2010-04-22 David Wetzel <dave@turbocat.de>
|
2010-04-22 David Wetzel <dave@turbocat.de>
|
||||||
|
|
||||||
* Source/Additions/Unicode.m: replace objc_malloc with NSZoneMalloc
|
* Source/Additions/Unicode.m: replace objc_malloc with NSZoneMalloc
|
||||||
|
|
|
@ -23,6 +23,9 @@
|
||||||
|
|
||||||
*/
|
*/
|
||||||
#import "common.h"
|
#import "common.h"
|
||||||
|
|
||||||
|
#if defined(NeXT_Foundation_LIBRARY)
|
||||||
|
|
||||||
#import "Foundation/NSByteOrder.h"
|
#import "Foundation/NSByteOrder.h"
|
||||||
#import "Foundation/NSHost.h"
|
#import "Foundation/NSHost.h"
|
||||||
#import "GSNetwork.h"
|
#import "GSNetwork.h"
|
||||||
|
@ -44,23 +47,28 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct addrinfo **ai, stru
|
||||||
const char *cPortn = NULL;
|
const char *cPortn = NULL;
|
||||||
int e = 0;
|
int e = 0;
|
||||||
|
|
||||||
if (!svc) {
|
if (!svc)
|
||||||
NSLog(@"service is nil.");
|
{
|
||||||
|
NSLog(@"service is nil.");
|
||||||
return NO;
|
|
||||||
}
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
hints->ai_flags = AI_PASSIVE | AI_ADDRCONFIG;
|
hints->ai_flags = AI_PASSIVE | AI_ADDRCONFIG;
|
||||||
hints->ai_protocol = IPPROTO_IP; // accept any
|
hints->ai_protocol = IPPROTO_IP; // accept any
|
||||||
|
|
||||||
if (pcl) {
|
if (pcl)
|
||||||
if ([pcl isEqualToString:@"tcp"]) {
|
{
|
||||||
hints->ai_protocol = IPPROTO_TCP;
|
if ([pcl isEqualToString:@"tcp"])
|
||||||
hints->ai_socktype = SOCK_STREAM;
|
{
|
||||||
} else if ([pcl isEqualToString:@"udp"]) {
|
hints->ai_protocol = IPPROTO_TCP;
|
||||||
hints->ai_protocol = IPPROTO_UDP;
|
hints->ai_socktype = SOCK_STREAM;
|
||||||
}
|
}
|
||||||
}
|
else if ([pcl isEqualToString:@"udp"])
|
||||||
|
{
|
||||||
|
hints->ai_protocol = IPPROTO_UDP;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If we were given a hostname, we use any address for that host.
|
* If we were given a hostname, we use any address for that host.
|
||||||
|
@ -68,16 +76,16 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct addrinfo **ai, stru
|
||||||
* a null (any address).
|
* a null (any address).
|
||||||
*/
|
*/
|
||||||
if (name)
|
if (name)
|
||||||
{
|
|
||||||
NSHost* host = [NSHost hostWithName: name];
|
|
||||||
|
|
||||||
if (host != nil)
|
|
||||||
{
|
{
|
||||||
name = [host address];
|
NSHost* host = [NSHost hostWithName: name];
|
||||||
NSLog(@"host address '%@'", name);
|
|
||||||
cHostn = [name cStringUsingEncoding:NSASCIIStringEncoding];
|
if (host != nil)
|
||||||
|
{
|
||||||
|
name = [host address];
|
||||||
|
NSLog(@"host address '%@'", name);
|
||||||
|
cHostn = [name cStringUsingEncoding:NSASCIIStringEncoding];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
cPortn = [svc cStringUsingEncoding:NSASCIIStringEncoding];
|
cPortn = [svc cStringUsingEncoding:NSASCIIStringEncoding];
|
||||||
|
|
||||||
|
@ -87,17 +95,18 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct addrinfo **ai, stru
|
||||||
//&ai
|
//&ai
|
||||||
e = getaddrinfo (cHostn, cPortn, hints, ai);
|
e = getaddrinfo (cHostn, cPortn, hints, ai);
|
||||||
|
|
||||||
if (e != 0) {
|
if (e != 0)
|
||||||
NSLog(@"getaddrinfo: %s", gai_strerror (e));
|
{
|
||||||
return NO;
|
NSLog(@"getaddrinfo: %s", gai_strerror (e));
|
||||||
}
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) initAsServerAtAddress: (NSString*)a
|
- (id) initAsServerAtAddress: (NSString*)a
|
||||||
service: (NSString*)s
|
service: (NSString*)s
|
||||||
protocol: (NSString*)p
|
protocol: (NSString*)p
|
||||||
{
|
{
|
||||||
#ifndef BROKEN_SO_REUSEADDR
|
#ifndef BROKEN_SO_REUSEADDR
|
||||||
int status = 1;
|
int status = 1;
|
||||||
|
@ -190,45 +199,46 @@ cleanup:
|
||||||
socklen_t size = sizeof(sstore);
|
socklen_t size = sizeof(sstore);
|
||||||
|
|
||||||
if (getsockname([self fileDescriptor], (struct sockaddr*)&sstore, &size) < 0)
|
if (getsockname([self fileDescriptor], (struct sockaddr*)&sstore, &size) < 0)
|
||||||
{
|
{
|
||||||
NSLog(@"unable to get socket name - %@", [NSError _last]);
|
NSLog(@"unable to get socket name - %@", [NSError _last]);
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
sadr = (struct sockaddr *) &sstore;
|
sadr = (struct sockaddr *) &sstore;
|
||||||
|
|
||||||
switch (sadr->sa_family) {
|
switch (sadr->sa_family)
|
||||||
case AF_INET6:
|
|
||||||
{
|
{
|
||||||
|
case AF_INET6:
|
||||||
char straddr[INET6_ADDRSTRLEN];
|
{
|
||||||
struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)&sstore;
|
char straddr[INET6_ADDRSTRLEN];
|
||||||
|
struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)&sstore;
|
||||||
inet_ntop(AF_INET6, &(addr6->sin6_addr), straddr,
|
|
||||||
sizeof(straddr));
|
inet_ntop(AF_INET6, &(addr6->sin6_addr), straddr,
|
||||||
|
sizeof(straddr));
|
||||||
return [NSString stringWithCString:straddr
|
|
||||||
encoding:NSASCIIStringEncoding];
|
return [NSString stringWithCString: straddr
|
||||||
break;
|
encoding: NSASCIIStringEncoding];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case AF_INET:
|
||||||
|
{
|
||||||
|
|
||||||
|
struct sockaddr_in * addr4 = (struct sockaddr_in*) &sstore;
|
||||||
|
|
||||||
|
char *address = inet_ntoa(addr4->sin_addr);
|
||||||
|
|
||||||
|
return [NSString stringWithCString: address
|
||||||
|
encoding: NSASCIIStringEncoding];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
case AF_INET:
|
|
||||||
{
|
|
||||||
|
|
||||||
struct sockaddr_in * addr4 = (struct sockaddr_in*) &sstore;
|
|
||||||
|
|
||||||
char *address = inet_ntoa(addr4->sin_addr);
|
|
||||||
|
|
||||||
return [NSString stringWithCString:address
|
|
||||||
encoding:NSASCIIStringEncoding];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
#endif /* defined(NeXT_Foundation_LIBRARY) */
|
||||||
|
|
||||||
|
|
|
@ -1238,7 +1238,7 @@ quotedFromString(NSString *aString)
|
||||||
SetHandleInformation(hOut, HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT);
|
SetHandleInformation(hOut, HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT);
|
||||||
SetHandleInformation(hErr, HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT);
|
SetHandleInformation(hErr, HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT);
|
||||||
|
|
||||||
result = CreateProcessW(wexecutable,
|
result = CreateProcessW(NULL, //wexecutable,
|
||||||
w_args,
|
w_args,
|
||||||
NULL, /* proc attrs */
|
NULL, /* proc attrs */
|
||||||
NULL, /* thread attrs */
|
NULL, /* thread attrs */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue