diff --git a/Testing/basic.m b/Testing/basic.m index 7091d6e20..d0674252a 100644 --- a/Testing/basic.m +++ b/Testing/basic.m @@ -1,92 +1,27 @@ +#include +#include -#import -@interface TaskMan : NSObject +#if 1 +int main () { - NSMutableArray *taskList; + id pool = [NSAutoreleasePool new]; + id o = [NSObject new]; + printf ("Hello from object at 0x%x\n", (unsigned)[o self]); + exit (0); } - --nextTask:(NSNotification *) aNotification; -@end - -@implementation TaskMan --init +#else +int main (int argc, char **argv) { - NSTask *aTask; - - self = [super init]; - - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(nextTask:) - name:NSTaskDidTerminateNotification - object:nil]; - - taskList = [[NSMutableArray alloc] init]; - - aTask = [[NSTask alloc] init]; - [aTask setLaunchPath:@"/bin/ls"]; - [aTask setArguments:nil]; - [taskList addObject:aTask]; - - aTask = [[NSTask alloc] init]; - [aTask setLaunchPath:@"/bin/ps"]; - [aTask setArguments:nil]; - [taskList addObject:aTask]; - - aTask = [[NSTask alloc] init]; - [aTask setLaunchPath:@"/bin/pwd"]; - [aTask setArguments:nil]; - [taskList addObject:aTask]; - - aTask = [[NSTask alloc] init]; - [aTask setLaunchPath:@"/bin/date"]; - [aTask setArguments:nil]; - [taskList addObject:aTask]; - - [[taskList objectAtIndex:0] launch]; - - return self; + NSString *string; + id pool = [NSAutoreleasePool new]; + NSProcessInfo *info = [NSProcessInfo processInfo]; + NSUserDefaults *defaults; + + NSLog(@"Temporary directory - %@", NSTemporaryDirectory()); + [info setProcessName: @"TestProcess"]; + defaults = [NSUserDefaults standardUserDefaults]; + NSLog(@"%@", [defaults dictionaryRepresentation]); + return 0; } - --nextTask:(NSNotification *) aNotification -{ - if ([[aNotification object] terminationStatus] == 0) { - [NSNotification notificationWithName:@"CommandCompletedSuccessfully" - object:self]; - } else { - [NSNotification notificationWithName:@"CommandFailed" - object:self]; - } - [taskList removeObjectAtIndex:0]; - - if ([taskList count] > 0) - [[taskList objectAtIndex:0] launch]; - else - exit(0); - - return self; -} -@end - -int main(int argc, char **argv, char** env) -{ - NSAutoreleasePool *pool; - TaskMan *aTaskMan; - int i = 0; - - pool = [NSAutoreleasePool new]; - aTaskMan = [[TaskMan alloc] init]; - - while(1) { - [[NSRunLoop currentRunLoop] runOnceBeforeDate: - [NSDate dateWithTimeIntervalSinceNow: 5]]; - -/* Uncomment the following line, and the app will complete all tasks */ -/* otherwise it will hang */ -//printf("%d\n", i++); -// NSLog(@""); - } - - exit(0); -} - +#endif