mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Re-commit
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@13060 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
7147084838
commit
07c3450559
2 changed files with 52 additions and 17 deletions
|
@ -9,6 +9,8 @@ Sat Mar 9 12:02:45 2002 Adam Fedor <fedor@yogi.doc.com>
|
|||
* Source/NSFileManager.m: Change copy so that, if the source argument
|
||||
is a symbolic link, we copy the link rather than the thing it points
|
||||
to.
|
||||
* Tools/gdnc.m: Quick hack to register port with other names is NSHost
|
||||
is used.
|
||||
|
||||
2002-03-08 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
|
|
67
Tools/gdnc.m
67
Tools/gdnc.m
|
@ -19,18 +19,7 @@
|
|||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <Foundation/NSObject.h>
|
||||
#include <Foundation/NSConnection.h>
|
||||
#include <Foundation/NSData.h>
|
||||
#include <Foundation/NSDistantObject.h>
|
||||
#include <Foundation/NSException.h>
|
||||
#include <Foundation/NSNotification.h>
|
||||
#include <Foundation/NSHashTable.h>
|
||||
#include <Foundation/NSMapTable.h>
|
||||
#include <Foundation/NSAutoreleasePool.h>
|
||||
#include <Foundation/NSProcessInfo.h>
|
||||
#include <Foundation/NSUserDefaults.h>
|
||||
#include <Foundation/NSDistributedNotificationCenter.h>
|
||||
#include <Foundation/Foundation.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
@ -222,6 +211,8 @@
|
|||
|
||||
- (id) init
|
||||
{
|
||||
NSString *hostname;
|
||||
|
||||
connections = NSCreateMapTable(NSObjectMapKeyCallBacks,
|
||||
NSNonOwnedPointerMapValueCallBacks, 0);
|
||||
allObservers = NSCreateHashTable(NSNonOwnedPointerHashCallBacks, 0);
|
||||
|
@ -229,11 +220,53 @@
|
|||
observersForObjects = [NSMutableDictionary new];
|
||||
conn = [NSConnection defaultConnection];
|
||||
[conn setRootObject: self];
|
||||
if ([conn registerName: GDNC_SERVICE] == NO)
|
||||
|
||||
hostname = [[NSUserDefaults standardUserDefaults] stringForKey: @"NSHost"];
|
||||
if ([hostname length] == 0)
|
||||
{
|
||||
NSLog(@"gdnc - unable to register with name server - quiting.\n");
|
||||
DESTROY(self);
|
||||
return self;
|
||||
if ([conn registerName: GDNC_SERVICE] == NO)
|
||||
{
|
||||
NSLog(@"gdnc - unable to register with name server - quiting.");
|
||||
DESTROY(self);
|
||||
return self;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NSHost *host = [NSHost hostWithName: hostname];
|
||||
NSPort *port = [conn receivePort];
|
||||
NSPortNameServer *ns = [NSPortNameServer systemDefaultPortNameServer];
|
||||
NSArray *a;
|
||||
unsigned c;
|
||||
|
||||
if (host == nil)
|
||||
{
|
||||
NSLog(@"gdnc - unknown NSHost argument ... %@ - quiting.", hostname);
|
||||
DESTROY(self);
|
||||
return self;
|
||||
}
|
||||
a = [host names];
|
||||
c = [a count];
|
||||
while (c-- > 0)
|
||||
{
|
||||
NSString *name = [a objectAtIndex: c];
|
||||
|
||||
name = [GDNC_SERVICE stringByAppendingFormat: @"-%@", name];
|
||||
if ([ns registerPort: port forName: name] == NO)
|
||||
{
|
||||
}
|
||||
}
|
||||
a = [host addresses];
|
||||
c = [a count];
|
||||
while (c-- > 0)
|
||||
{
|
||||
NSString *name = [a objectAtIndex: c];
|
||||
|
||||
name = [GDNC_SERVICE stringByAppendingFormat: @"-%@", name];
|
||||
if ([ns registerPort: port forName: name] == NO)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -374,7 +407,7 @@
|
|||
|
||||
if (connection == conn)
|
||||
{
|
||||
NSLog(@"argh - gdnc server root connection has been destroyed.\n");
|
||||
NSLog(@"argh - gdnc server root connection has been destroyed.");
|
||||
exit(1);
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue