mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 16:50:58 +00:00
More host tweaks
This commit is contained in:
parent
19a0a8d10b
commit
0c4498a7cc
3 changed files with 9 additions and 16 deletions
|
@ -199,21 +199,10 @@ myHostName()
|
||||||
hints.ai_flags = AI_CANONNAME;
|
hints.ai_flags = AI_CANONNAME;
|
||||||
hints.ai_family = AF_UNSPEC;
|
hints.ai_family = AF_UNSPEC;
|
||||||
|
|
||||||
if ([key isEqualToString: myHostName()])
|
if ([key isEqualToString: localHostName])
|
||||||
{
|
{
|
||||||
[addresses addObject: @"127.0.0.1"];
|
[addresses unionSet: [hostClass _localAddresses]];
|
||||||
#if defined(AF_INET6)
|
ptr = "localhost";
|
||||||
[addresses addObject: @"::1"];
|
|
||||||
#endif
|
|
||||||
[names addObject: @"localhost"];
|
|
||||||
}
|
|
||||||
else if ([key isEqualToString: localHostName]
|
|
||||||
|| [key isEqualToString: @"localhost"])
|
|
||||||
{
|
|
||||||
#if defined(AF_INET6)
|
|
||||||
[addresses addObject: @"::1"];
|
|
||||||
#endif
|
|
||||||
ptr = "127.0.0.1";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
err = getaddrinfo(ptr, 0, &hints, &entry);
|
err = getaddrinfo(ptr, 0, &hints, &entry);
|
||||||
|
|
|
@ -6,8 +6,11 @@
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
NSAutoreleasePool *arp = [NSAutoreleasePool new];
|
NSAutoreleasePool *arp = [NSAutoreleasePool new];
|
||||||
test_NSObject(@"NSHost",[NSArray arrayWithObject:[NSHost currentHost]]);
|
NSHost *h = [NSHost currentHost];
|
||||||
|
|
||||||
|
test_NSObject(@"NSHost", [NSArray arrayWithObject: h]);
|
||||||
|
NSLog(@"%@", h);
|
||||||
[arp release]; arp = nil;
|
[arp release]; arp = nil;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ int main()
|
||||||
localh = [NSHost localHost];
|
localh = [NSHost localHost];
|
||||||
PASS(localh != nil && [localh isKindOfClass: [NSHost class]],
|
PASS(localh != nil && [localh isKindOfClass: [NSHost class]],
|
||||||
"NSHost understands +localHost");
|
"NSHost understands +localHost");
|
||||||
|
NSLog(@"localHost: %@", localh);
|
||||||
#else
|
#else
|
||||||
localh = current;
|
localh = current;
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue