1 #include <Foundation/Foundation.h>
2 #include <CoreFoundation/CoreFoundation.h>
11 const char *Firmware_ = NULL;
17 #define FW_LEAST(major, minor, bugfix) \
18 (major < Major_ || major == Major_ && \
19 (minor < Minor_ || minor == Minor_ && \
22 int main(int argc, char *argv[]) {
23 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
25 if (NSDictionary *sysver = [NSDictionary dictionaryWithContentsOfFile:@"/System/Library/CoreServices/SystemVersion.plist"]) {
26 if (NSString *prover = [sysver valueForKey:@"ProductVersion"]) {
27 Firmware_ = strdup([prover UTF8String]);
28 NSArray *versions = [prover componentsSeparatedByString:@"."];
29 int count = [versions count];
30 Major_ = count > 0 ? [[versions objectAtIndex:0] intValue] : 0;
31 Minor_ = count > 1 ? [[versions objectAtIndex:1] intValue] : 0;
32 BugFix_ = count > 2 ? [[versions objectAtIndex:2] intValue] : 0;
47 struct passwd *passwd = getpwnam(user);
49 if (setreuid(passwd->pw_uid, 0) == -1) {
54 if (setregid(passwd->pw_gid, 0) == -1) {
59 if (execvp(argv[1], argv + 1) == -1) {