mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
Tidied
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@16707 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
e11c5887a6
commit
fe96343fc7
1 changed files with 49 additions and 2 deletions
51
Tools/gdnc.m
51
Tools/gdnc.m
|
@ -18,7 +18,7 @@
|
|||
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "config.h"
|
||||
#include <Foundation/Foundation.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -28,6 +28,39 @@
|
|||
#include "process.h"
|
||||
#endif
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
#ifndef NSIG
|
||||
#define NSIG 32
|
||||
#endif
|
||||
|
||||
static void
|
||||
ihandler(int sig)
|
||||
{
|
||||
int count;
|
||||
|
||||
/*
|
||||
* Reset signals to avoid recursive call of handler.
|
||||
*/
|
||||
for (count = 0; count < NSIG; count++)
|
||||
{
|
||||
signal((int)count, SIG_DFL);
|
||||
}
|
||||
/*
|
||||
* If asked to terminate, do so cleanly.
|
||||
*/
|
||||
if (sig == SIGTERM)
|
||||
{
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
/*
|
||||
* Terminate with an abort ... should give us a core dump so we can
|
||||
* debug and find out why this happened.
|
||||
*/
|
||||
abort();
|
||||
}
|
||||
|
||||
|
||||
#include "gdnc.h"
|
||||
|
||||
@interface GDNCNotification : NSObject
|
||||
|
@ -860,11 +893,25 @@ main(int argc, char** argv, char** env)
|
|||
#if GS_WITH_GC == 0
|
||||
CREATE_AUTORELEASE_POOL(pool);
|
||||
#endif
|
||||
NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
|
||||
NSUserDefaults *defs;
|
||||
int sym;
|
||||
|
||||
for (sym = 0; sym < NSIG; sym++)
|
||||
{
|
||||
signal(sym, ihandler);
|
||||
}
|
||||
#ifndef __MINGW__
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
signal(SIGTTOU, SIG_IGN);
|
||||
signal(SIGTTIN, SIG_IGN);
|
||||
signal(SIGHUP, SIG_IGN);
|
||||
#endif
|
||||
signal(SIGTERM, ihandler);
|
||||
|
||||
/*
|
||||
* Make gdnc logging go to syslog unless overridden by user.
|
||||
*/
|
||||
defs = [NSUserDefaults standardUserDefaults];
|
||||
[defs registerDefaults: [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
@"YES", @"GSLogSyslog", nil]];
|
||||
|
||||
|
|
Loading…
Reference in a new issue