-
Notifications
You must be signed in to change notification settings - Fork 70
/
main.m
54 lines (44 loc) · 1.25 KB
/
main.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//
// main.m
// APIScanner
//
// Created by Andrew Schenk on 9/2/10.
// Copyright 2010 Chimp Studios. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import "MainCommand.h"
#import "Constants.h"
int main(int argc, char *argv[])
{
NSAutoreleasePool *myPool = [[NSAutoreleasePool alloc] init];
NSUserDefaults *args = [NSUserDefaults standardUserDefaults];
NSString *path = [args stringForKey:@"p"];
BOOL verbose = [args boolForKey:@"v"];
BOOL update = [args boolForKey:@"u"];
if([args integerForKey:@"l"]) {
int level = [args integerForKey:@"l"];
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:kPrefFilterSet];
[[NSUserDefaults standardUserDefaults] setInteger:level forKey:kPrefFilter];
}
if (verbose) {
NSLog(@"path = %@", path);
if([args integerForKey:@"l"]) {
NSLog(@"filter level = %i (pc)", [args integerForKey:@"l"]);
} else {
NSLog(@"filter level not set, using default");
}
NSLog(@"verbose is ON");
}
if (path) {
MainCommand *mc = [[MainCommand alloc] initWithUpdate:update andVerbose:verbose];
if (verbose) {
NSLog(@"starting scanner...");
}
[mc startScanningFile:path];
[mc release];
[myPool release];
return 0;
}
[myPool release];
return NSApplicationMain(argc, (const char **) argv);
}