mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-25 09:41:15 +00:00
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@3105 72102866-910b-0410-8b05-ffd578937521
50 lines
1 KiB
Objective-C
50 lines
1 KiB
Objective-C
// Fri Oct 23 03:02:52 MET DST 1998 dave@turbocat.de
|
|
// cStringNoCopy -> cString
|
|
|
|
#include <Foundation/NSArray.h>
|
|
#include <Foundation/NSString.h>
|
|
#include <Foundation/NSHost.h>
|
|
#include <Foundation/NSAutoreleasePool.h>
|
|
|
|
void
|
|
displayHost(NSHost* h)
|
|
{
|
|
NSArray* a;
|
|
int i;
|
|
|
|
printf("\n");
|
|
a = [h names];
|
|
for (i = 0; i < [a count]; i++)
|
|
printf("%s\n", [[a objectAtIndex:i] cString]);
|
|
a = [h addresses];
|
|
for (i = 0; i < [a count]; i++)
|
|
printf("%s\n", [[a objectAtIndex:i] cString]);
|
|
}
|
|
|
|
int
|
|
main ()
|
|
{
|
|
NSHost* a;
|
|
NSHost* c;
|
|
NSHost* n;
|
|
NSAutoreleasePool *arp = [NSAutoreleasePool new];
|
|
|
|
[NSAutoreleasePool enableDoubleReleaseCheck:YES];
|
|
c = [NSHost currentHost];
|
|
displayHost(c);
|
|
n = [NSHost hostWithName:[c name]];
|
|
displayHost(n);
|
|
a = [NSHost hostWithAddress:[c address]];
|
|
displayHost(a);
|
|
|
|
printf("c:%lx, n:%lx, a:%lx\n", c, n, a);
|
|
|
|
[NSHost setHostCacheEnabled:NO];
|
|
|
|
n = [NSHost hostWithName:[c name]];
|
|
displayHost(n);
|
|
printf("c:%lx, n:%lx, a:%lx\n", c, n, a);
|
|
|
|
[arp release];
|
|
exit (0);
|
|
}
|