14
14
You should have received a copy of the GNU General Public
15
15
License along with this library; see the file COPYING.LIB.
16
16
If not, write to the Free Software Foundation,
17
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
129
129
action = NO; // exit() by default.
131
e = getenv("CRASH_ON_ABORT");
131
e = [[[NSProcessInfo processInfo] environment] objectForKey:
134
if (strcasecmp(e, "yes") == 0 || strcasecmp(e, "true") == 0)
136
else if (strcasecmp(e, "no") == 0 || strcasecmp(e, "false") == 0)
138
else if (isdigit(*e) && *e != '0')
135
action = [e boolValue];
144
138
if (action == YES)
373
373
observersForNames = [NSMutableDictionary new];
374
374
observersForObjects = [NSMutableDictionary new];
376
if ([[NSUserDefaults standardUserDefaults] boolForKey: @"GSNetwork"] == YES)
376
defs = [NSUserDefaults standardUserDefaults];
377
hostname = [defs stringForKey: @"NSHost"];
378
if ([hostname length] > 0 || [defs boolForKey: @"GSPublic"] == YES)
380
if (hostname == nil || [hostname isEqualToString: @"localhost"] == YES
381
|| [hostname isEqualToString: @"127.0.0.1"] == YES)
387
else if ([defs boolForKey: @"GSNetwork"] == YES)
378
399
service = GDNC_NETWORK;
380
hostname = [[NSUserDefaults standardUserDefaults] stringForKey: @"NSHost"];
400
ns = [NSSocketPortNameServer sharedInstance];
401
port = (NSPort*)[NSSocketPort port];
405
service = GDNC_SERVICE;
406
ns = [NSSocketPortNameServer sharedInstance];
409
port = (NSPort*)[NSSocketPort portWithNumber: 0
410
onHost: [NSHost localHost]
411
forceAddress: @"127.0.0.1"
416
port = (NSPort*)[NSSocketPort port];
421
NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
423
if ([defs objectForKey: @"NSPortIsMessagePort"] != nil
424
&& [defs boolForKey: @"NSPortIsMessagePort"] == NO)
426
ns = [NSSocketPortNameServer sharedInstance];
427
port = (NSPort*)[NSSocketPort port];
431
ns = [NSMessagePortNameServer sharedInstance];
432
port = (NSPort*)[NSMessagePort port];
435
service = GDNC_SERVICE;
438
conn = [[NSConnection alloc] initWithReceivePort: port sendPort: nil];
439
[conn setRootObject: self];
381
441
if ([hostname length] == 0
382
|| [hostname isEqualToString: @"localhost"] == YES
383
|| [hostname isEqualToString: @"127.0.0.1"] == YES)
389
* If this is the local server for the current host,
390
* use the loopback network interface. Otherwise
391
* create a public connection.
393
if (0 && isLocal == YES && service != GDNC_NETWORK)
395
/* If this code is reactivated, it needs to deal correctly with the
396
case where NSSocketPort shouldn't be used (because it isn't the
397
default port). Something like
398
NSPort *port = [NSMessagePort port];
400
NSPort *port = [NSPort port];
402
NSPort *port = [NSSocketPort portWithNumber: 0
403
onHost: [NSHost localHost]
404
forceAddress: @"127.0.0.1"
406
conn = [[NSConnection alloc] initWithReceivePort: port sendPort: nil];
410
conn = [NSConnection defaultConnection];
412
[conn setRootObject: self];
415
442
|| [[NSHost hostWithName: hostname] isEqual: [NSHost currentHost]] == YES)
417
if ([conn registerName: service] == NO)
444
if ([conn registerName: service withNameServer: ns] == NO)
419
446
NSLog(@"gdnc - unable to register with name server as %@ - quiting.",
981
/** <p>The gdnc daemon is used by GNUstep programs to send notifications and
982
messages to one another, in conjunction with the Base library
983
Notification-related classes.</p>
985
<p>Every user needs to have his own instance of gdnc running. While gdnc
986
will be started automatically as soon as it is needed, it is recommended
987
to start gdnc in a personal login script like ~/.bashrc or ~/.cshrc.
988
Alternatively you can launch gpbs when your windowing system or the
989
window manager is started. For example, on systems with X11 you can
990
launch gdnc from your .xinitrc script or alternatively - if you are
991
running Window Maker - put it in Window Maker's autostart script. See
992
the GNUstep Build Guide for a sample startup script.</p>
994
<p>Please see the man page for more information.
1008
<p>The gdnc daemon is used by GNUstep programs to send notifications and
1009
messages to one another, in conjunction with the Base library
1010
Notification-related classes.</p>
1012
<p>Every user needs to have his own instance of gdnc running. While gdnc
1013
will be started automatically as soon as it is needed, it is recommended
1014
to start gdnc in a personal login script like ~/.bashrc or ~/.cshrc.
1015
Alternatively (if you have no command-line tools which use distributed
1016
notifications) you can launch gdnc when your windowing system or the
1017
window manager is started. For example, on systems with X11 you can
1018
launch gdnc from your .xinitrc script or alternatively - if you are
1019
running Window Maker - put it in Window Maker's autostart script. See
1020
the GNUstep Build Guide for a sample startup script.</p>
1022
<p>Please see the man page for more information.</p>
997
1025
main(int argc, char** argv, char** env)