mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 16:30:41 +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_family = AF_UNSPEC;
|
||||
|
||||
if ([key isEqualToString: myHostName()])
|
||||
if ([key isEqualToString: localHostName])
|
||||
{
|
||||
[addresses addObject: @"127.0.0.1"];
|
||||
#if defined(AF_INET6)
|
||||
[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";
|
||||
[addresses unionSet: [hostClass _localAddresses]];
|
||||
ptr = "localhost";
|
||||
}
|
||||
|
||||
err = getaddrinfo(ptr, 0, &hints, &entry);
|
||||
|
|
|
@ -6,8 +6,11 @@
|
|||
|
||||
int main()
|
||||
{
|
||||
NSAutoreleasePool *arp = [NSAutoreleasePool new];
|
||||
test_NSObject(@"NSHost",[NSArray arrayWithObject:[NSHost currentHost]]);
|
||||
NSAutoreleasePool *arp = [NSAutoreleasePool new];
|
||||
NSHost *h = [NSHost currentHost];
|
||||
|
||||
test_NSObject(@"NSHost", [NSArray arrayWithObject: h]);
|
||||
NSLog(@"%@", h);
|
||||
[arp release]; arp = nil;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ int main()
|
|||
localh = [NSHost localHost];
|
||||
PASS(localh != nil && [localh isKindOfClass: [NSHost class]],
|
||||
"NSHost understands +localHost");
|
||||
NSLog(@"localHost: %@", localh);
|
||||
#else
|
||||
localh = current;
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue