/*
* © 2009, Steven Troughton-Smith
* http://steventroughtonsmith.blogspot.com
*/

#import <Foundation/Foundation.h>

int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

NSMutableArray *args = [NSMutableArray array];

for (int i = 0; i < argc; i++)
{
[args addObject:[NSString stringWithUTF8String:argv[i]]];
}

NSTask *b = [NSTask new];


/* Use the path to your original SpringBoard binary */

[b setLaunchPath:@"/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.2.sdk/System/Library/CoreServices/SpringBoard.app/SpringBoard_b"];
[b setArguments:args];

NSMutableDictionary *env = [NSMutableDictionary dictionaryWithDictionary:[[NSProcessInfo processInfo] environment]];

/* Use the path to your Dynamic Library */
[env setObject:@"/Library/MobileSubstrate/DynamicLibraries/MobileStack.dylib" forKey:@"DYLD_INSERT_LIBRARIES"];

[b setEnvironment:env];

[b launch];

while ([b isRunning])
{

}

[pool drain];
return 0;
}