summaryrefslogtreecommitdiffstats
path: root/plutil/plutil.c
diff options
context:
space:
mode:
Diffstat (limited to 'plutil/plutil.c')
-rw-r--r--plutil/plutil.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/plutil/plutil.c b/plutil/plutil.c
index 0431dc6..37d83df 100644
--- a/plutil/plutil.c
+++ b/plutil/plutil.c
@@ -30,6 +30,11 @@
30 30
31int main(int argc, char *argv[]) 31int main(int argc, char *argv[])
32{ 32{
33 FILE *iplist = NULL;
34 plist_t root_node = NULL;
35 char *plist_out = NULL;
36 int size = 0;
37 char *plist_entire = NULL;
33 struct stat *filestats = (struct stat *) malloc(sizeof(struct stat)); 38 struct stat *filestats = (struct stat *) malloc(sizeof(struct stat));
34 Options *options = parse_arguments(argc, argv); 39 Options *options = parse_arguments(argc, argv);
35 40
@@ -38,19 +43,17 @@ int main(int argc, char *argv[])
38 return 0; 43 return 0;
39 } 44 }
40 //read input file 45 //read input file
41 FILE *iplist = fopen(options->in_file, "r"); 46 iplist = fopen(options->in_file, "rb");
42 if (!iplist) 47 if (!iplist)
43 return 1; 48 return 1;
44 stat(options->in_file, filestats); 49 stat(options->in_file, filestats);
45 char *plist_entire = (char *) malloc(sizeof(char) * (filestats->st_size + 1)); 50 plist_entire = (char *) malloc(sizeof(char) * (filestats->st_size + 1));
46 fread(plist_entire, sizeof(char), filestats->st_size, iplist); 51 fread(plist_entire, sizeof(char), filestats->st_size, iplist);
47 fclose(iplist); 52 fclose(iplist);
48 53
49 54
50 //convert one format to another 55 //convert one format to another
51 plist_t root_node = NULL; 56
52 char *plist_out = NULL;
53 int size = 0;
54 57
55 if (memcmp(plist_entire, "bplist00", 8) == 0) { 58 if (memcmp(plist_entire, "bplist00", 8) == 0) {
56 plist_from_bin(plist_entire, filestats->st_size, &root_node); 59 plist_from_bin(plist_entire, filestats->st_size, &root_node);