summaryrefslogtreecommitdiffstats
path: root/dev
diff options
context:
space:
mode:
Diffstat (limited to 'dev')
-rw-r--r--dev/plutil.c29
1 files changed, 13 insertions, 16 deletions
diff --git a/dev/plutil.c b/dev/plutil.c
index 4a34077..e76506e 100644
--- a/dev/plutil.c
+++ b/dev/plutil.c
@@ -18,8 +18,6 @@ int main(int argc, char *argv[])
18 Options *options = parse_arguments(argc, argv); 18 Options *options = parse_arguments(argc, argv);
19 int argh = 0; 19 int argh = 0;
20 20
21 printf("plistutil version 0.2 written by FxChiP\n");
22
23 if (!options) { 21 if (!options) {
24 print_usage(); 22 print_usage();
25 return 0; 23 return 0;
@@ -31,26 +29,25 @@ int main(int argc, char *argv[])
31 29
32 stat(options->in_file, filestats); 30 stat(options->in_file, filestats);
33 31
34 printf("here?\n");
35 char *bplist_entire = (char *) malloc(sizeof(char) * (filestats->st_size + 1)); 32 char *bplist_entire = (char *) malloc(sizeof(char) * (filestats->st_size + 1));
36 //argh = fgets(bplist_entire, filestats->st_size, bplist);
37 argh = fread(bplist_entire, sizeof(char), filestats->st_size, bplist); 33 argh = fread(bplist_entire, sizeof(char), filestats->st_size, bplist);
38 printf("read %i bytes\n", argh);
39 fclose(bplist); 34 fclose(bplist);
40 printf("or here?\n");
41 // bplist_entire contains our stuff 35 // bplist_entire contains our stuff
36
42 plist_t root_node = NULL; 37 plist_t root_node = NULL;
43 bin_to_plist(bplist_entire, filestats->st_size, &root_node); 38 char *plist_out = NULL;
44 printf("plutil debug mode\n\n");
45 printf("file size %i\n\n", (int) filestats->st_size);
46 if (!root_node) {
47 printf("Invalid binary plist (or some other error occurred.)\n");
48 return 0;
49 }
50 char *plist_xml = NULL;
51 int size = 0; 39 int size = 0;
52 plist_to_xml(root_node, &plist_xml, &size); 40
53 printf("%s\n", plist_xml); 41 if (memcmp(bplist_entire, "bplist00", 8) == 0) {
42 bin_to_plist(bplist_entire, filestats->st_size, &root_node);
43 plist_to_xml(root_node, &plist_out, &size);
44 } else {
45 xml_to_plist(bplist_entire, filestats->st_size, &root_node);
46 plist_to_bin(root_node, &plist_out, &size);
47 }
48
49
50 printf("%s\n", plist_out);
54 return 0; 51 return 0;
55} 52}
56 53