2006-06-15 21:34:10 +02:00
|
|
|
/*
|
|
|
|
Copyright (C) 2004-2005 SKYRIX Software AG
|
|
|
|
|
|
|
|
This file is part of OpenGroupware.org.
|
|
|
|
|
|
|
|
OGo is free software; you can redistribute it and/or modify it under
|
|
|
|
the terms of the GNU Lesser General Public License as published by the
|
|
|
|
Free Software Foundation; either version 2, or (at your option) any
|
|
|
|
later version.
|
|
|
|
|
|
|
|
OGo is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
|
|
|
License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
|
|
License along with OGo; see the file COPYING. If not, write to the
|
|
|
|
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
|
|
|
02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
2007-06-21 23:16:03 +02:00
|
|
|
#import <unistd.h>
|
|
|
|
|
2007-06-29 23:55:16 +02:00
|
|
|
#import <Foundation/NSAutoreleasePool.h>
|
|
|
|
#import <Foundation/NSString.h>
|
2006-10-04 21:19:38 +02:00
|
|
|
#import <Foundation/NSTimeZone.h>
|
2007-06-29 23:55:16 +02:00
|
|
|
#import <Foundation/NSUserDefaults.h>
|
2006-06-15 21:34:10 +02:00
|
|
|
|
2007-06-29 23:55:16 +02:00
|
|
|
#import <NGObjWeb/SoApplication.h>
|
2006-10-04 21:19:38 +02:00
|
|
|
|
2007-04-16 23:41:50 +02:00
|
|
|
int
|
|
|
|
main (int argc, char **argv, char **env)
|
2006-10-04 21:19:38 +02:00
|
|
|
{
|
|
|
|
NSString *tzName;
|
|
|
|
NSUserDefaults *ud;
|
2006-06-15 21:34:10 +02:00
|
|
|
NSAutoreleasePool *pool;
|
2007-06-21 23:16:03 +02:00
|
|
|
int rc;
|
2006-06-15 21:34:10 +02:00
|
|
|
|
2007-02-08 17:24:59 +01:00
|
|
|
pool = [NSAutoreleasePool new];
|
2007-06-21 23:16:03 +02:00
|
|
|
|
2007-06-29 23:55:16 +02:00
|
|
|
rc = -1;
|
|
|
|
|
2007-06-21 23:16:03 +02:00
|
|
|
if (getuid() > 0)
|
|
|
|
{
|
2007-04-25 01:08:02 +02:00
|
|
|
#if LIB_FOUNDATION_LIBRARY
|
2007-06-21 23:16:03 +02:00
|
|
|
[NSProcessInfo initializeWithArguments: argv count: argc environment: env];
|
2007-04-25 01:08:02 +02:00
|
|
|
#endif
|
2007-06-21 23:16:03 +02:00
|
|
|
ud = [NSUserDefaults standardUserDefaults];
|
2007-06-29 23:55:16 +02:00
|
|
|
rc = 0;
|
2007-06-21 23:16:03 +02:00
|
|
|
tzName = [ud stringForKey: @"SOGoServerTimeZone"];
|
|
|
|
if (!tzName)
|
2007-06-29 23:55:16 +02:00
|
|
|
tzName = @"UTC";
|
|
|
|
[NSTimeZone setDefaultTimeZone:
|
|
|
|
[NSTimeZone timeZoneWithName: tzName]];
|
2007-06-21 23:16:03 +02:00
|
|
|
WOWatchDogApplicationMain (@"SOGo", argc, (void *) argv);
|
|
|
|
}
|
|
|
|
else
|
2007-06-29 23:55:16 +02:00
|
|
|
NSLog (@"Don't run SOGo as root!");
|
2006-06-15 21:34:10 +02:00
|
|
|
|
|
|
|
[pool release];
|
2007-06-21 23:16:03 +02:00
|
|
|
|
|
|
|
return rc;
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|