libs-base/Testing/nshost.m
Adam Fedor 25afcc3594 Patches submitted from May 20 to Aug 28 1997
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@2406 72102866-910b-0410-8b05-ffd578937521
1997-09-01 21:59:51 +00:00

44 lines
821 B
Objective-C

#include <Foundation/NSArray.h>
#include <Foundation/NSString.h>
#include <Foundation/NSHost.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] cStringNoCopy]);
a = [h addresses];
for (i = 0; i < [a count]; i++)
printf("%s\n", [[a objectAtIndex:i] cStringNoCopy]);
}
int
main ()
{
NSHost* a;
NSHost* c;
NSHost* n;
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 release];
n = [NSHost hostWithName:[c name]];
displayHost(n);
printf("c:%lx, n:%lx, a:%lx\n", c, n, a);
exit (0);
}