-
-
Notifications
You must be signed in to change notification settings - Fork 60
Expand file tree
/
Copy pathmain.m
More file actions
65 lines (56 loc) · 1.82 KB
/
main.m
File metadata and controls
65 lines (56 loc) · 1.82 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
//
// main.m
// WebArchiveExtractor
//
// Created by Rob Rohan on 9/18/07.
// Copyright __MyCompanyName__ 2007. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import "Extractor.h"
#include <unistd.h>
int main(int argc, char *argv[])
{
int opt;
NSString *fileName = nil;
NSString *dirName = nil;
NSString *url = nil;
while ((opt = getopt(argc, (char * const *)argv, "ho:p:i:")) != -1) {
switch (opt) {
case 'h':
printf("Usage: %s [-h] [-o <OuputDirectory>] [-p <URLPrepend>] -i <WebArchiveFile> \n", argv[0]);
printf(" -h Show this help message\n");
printf(" -i WebArchiveFile The WebArchive (.webarchive) file\n");
printf(" -o OuputDirectory The directory to output extracted data (optional)\n");
printf(" -p URLPrepend URI to add to the front of the assets (optional)\n");
exit(0);
case 'i':
fileName = [NSString stringWithUTF8String:optarg];
break;
case 'o':
dirName = [NSString stringWithUTF8String:optarg];
break;
case 'p':
url = [NSString stringWithUTF8String:optarg];
break;
case '?':
// XCode and friends pass other flags we need to
// just ignore.
break;
}
}
if (fileName != nil)
{
Extractor * extr = [[Extractor alloc] init];
if(dirName != nil)
{
[extr setOutputPath:dirName];
}
if(url != nil)
{
[extr setURLPrepend:url];
}
[extr extractAuto:fileName dropViewRef:nil];
exit(0);
}
return NSApplicationMain(argc, (const char **) argv);
}