Fix bad '--help' line

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@20673 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2005-02-08 11:57:39 +00:00
parent 80a27b24c5
commit 98e22aaf4b
2 changed files with 26 additions and 7 deletions

View file

@ -7,6 +7,7 @@
* Tools/gdnc.m: Rewrite startup code to create a daemon using NSTask
rather than calling fork()/spawn() etc.
Make arguments more consistent with gpbs
* Source/NSTask.m: Minor code layout/indentation tweaks.
2005-02-02 09:40 Richard Frith-Macdonald <rfm@gnu.org>

View file

@ -39,7 +39,7 @@
#define NSIG 32
#endif
static int is_daemon = 0; /* Currently running as daemon. */
static BOOL is_daemon = NO; /* Currently running as daemon. */
static char ebuf[2048];
#ifdef HAVE_SYSLOG
@ -1000,6 +1000,7 @@ main(int argc, char** argv, char** env)
BOOL subtask = YES;
BOOL debugging = NO;
NSProcessInfo *pInfo;
NSMutableArray *args;
CREATE_AUTORELEASE_POOL(pool);
#ifdef GS_PASS_ARGUMENTS
@ -1007,9 +1008,30 @@ main(int argc, char** argv, char** env)
#endif
[NSObject enableDoubleReleaseCheck: YES];
pInfo = [NSProcessInfo processInfo];
if ([[pInfo arguments] containsObject: @"-f"] == YES)
args = AUTORELEASE([[pInfo arguments] mutableCopy]);
if ([[pInfo arguments] containsObject: @"--help"] == YES)
{
printf("gdnc\n\n");
printf("GNU Distributed Notification Center\n");
printf("--help\tfor help\n");
printf("--no-fork\tavoid fork() to make debugging easy\n");
printf("--verbose\tMore verbose debug output\n");
exit(EXIT_SUCCESS);
}
if ([[pInfo arguments] containsObject: @"--daemon"] == YES)
{
subtask = NO;
is_daemon = YES;
}
if ([[pInfo arguments] containsObject: @"-f"] == YES
|| [[pInfo arguments] containsObject: @"--no-fork"] == YES)
{
subtask = NO;
}
if ([[pInfo arguments] containsObject: @"--verbose"] == YES)
{
debugging = YES;
}
if ([[NSUserDefaults standardUserDefaults] boolForKey: @"debug"] == YES)
{
@ -1020,14 +1042,12 @@ main(int argc, char** argv, char** env)
if (subtask)
{
NSFileHandle *null;
NSMutableArray *args;
NSTask *t;
t = [NSTask new];
NS_DURING
{
args = [[pInfo arguments] mutableCopy];
[args addObject: @"-f"];
[args addObject: @"--daemon"];
[t setLaunchPath: [[NSBundle mainBundle] executablePath]];
[t setArguments: args];
[t setEnvironment: [pInfo environment]];
@ -1088,8 +1108,6 @@ main(int argc, char** argv, char** env)
}
#endif
is_daemon = YES;
RELEASE(pool);
}