diff options
Diffstat (limited to 'tools/ideviceimagemounter.c')
-rw-r--r-- | tools/ideviceimagemounter.c | 41 |
1 files changed, 6 insertions, 35 deletions
diff --git a/tools/ideviceimagemounter.c b/tools/ideviceimagemounter.c index 4ea38a9..f551b6c 100644 --- a/tools/ideviceimagemounter.c +++ b/tools/ideviceimagemounter.c | |||
@@ -46,7 +46,7 @@ | |||
46 | #include <libimobiledevice/notification_proxy.h> | 46 | #include <libimobiledevice/notification_proxy.h> |
47 | #include <libimobiledevice/mobile_image_mounter.h> | 47 | #include <libimobiledevice/mobile_image_mounter.h> |
48 | #include <asprintf.h> | 48 | #include <asprintf.h> |
49 | #include <libimobiledevice-glue/utils.h> | 49 | #include <plist/plist.h> |
50 | 50 | ||
51 | static int list_mode = 0; | 51 | static int list_mode = 0; |
52 | static int use_network = 0; | 52 | static int use_network = 0; |
@@ -143,15 +143,6 @@ static void parse_opts(int argc, char **argv) | |||
143 | } | 143 | } |
144 | } | 144 | } |
145 | 145 | ||
146 | static void print_xml(plist_t node) | ||
147 | { | ||
148 | char *xml = NULL; | ||
149 | uint32_t len = 0; | ||
150 | plist_to_xml(node, &xml, &len); | ||
151 | if (xml) | ||
152 | puts(xml); | ||
153 | } | ||
154 | |||
155 | static ssize_t mim_upload_cb(void* buf, size_t size, void* userdata) | 146 | static ssize_t mim_upload_cb(void* buf, size_t size, void* userdata) |
156 | { | 147 | { |
157 | return fread(buf, 1, size, (FILE*)userdata); | 148 | return fread(buf, 1, size, (FILE*)userdata); |
@@ -297,11 +288,7 @@ int main(int argc, char **argv) | |||
297 | err = mobile_image_mounter_lookup_image(mim, imagetype, &result); | 288 | err = mobile_image_mounter_lookup_image(mim, imagetype, &result); |
298 | if (err == MOBILE_IMAGE_MOUNTER_E_SUCCESS) { | 289 | if (err == MOBILE_IMAGE_MOUNTER_E_SUCCESS) { |
299 | res = 0; | 290 | res = 0; |
300 | if (xml_mode) { | 291 | plist_write_to_stream(result, stdout, (xml_mode) ? PLIST_FORMAT_XML : PLIST_FORMAT_LIMD, 0); |
301 | print_xml(result); | ||
302 | } else { | ||
303 | plist_print_to_stream(result, stdout); | ||
304 | } | ||
305 | } else { | 292 | } else { |
306 | printf("Error: lookup_image returned %d\n", err); | 293 | printf("Error: lookup_image returned %d\n", err); |
307 | } | 294 | } |
@@ -429,20 +416,12 @@ int main(int argc, char **argv) | |||
429 | res = 0; | 416 | res = 0; |
430 | } else { | 417 | } else { |
431 | printf("unexpected status value:\n"); | 418 | printf("unexpected status value:\n"); |
432 | if (xml_mode) { | 419 | plist_write_to_stream(result, stdout, (xml_mode) ? PLIST_FORMAT_XML : PLIST_FORMAT_LIMD, 0); |
433 | print_xml(result); | ||
434 | } else { | ||
435 | plist_print_to_stream(result, stdout); | ||
436 | } | ||
437 | } | 420 | } |
438 | free(status); | 421 | free(status); |
439 | } else { | 422 | } else { |
440 | printf("unexpected result:\n"); | 423 | printf("unexpected result:\n"); |
441 | if (xml_mode) { | 424 | plist_write_to_stream(result, stdout, (xml_mode) ? PLIST_FORMAT_XML : PLIST_FORMAT_LIMD, 0); |
442 | print_xml(result); | ||
443 | } else { | ||
444 | plist_print_to_stream(result, stdout); | ||
445 | } | ||
446 | } | 425 | } |
447 | } | 426 | } |
448 | node = plist_dict_get_item(result, "Error"); | 427 | node = plist_dict_get_item(result, "Error"); |
@@ -454,19 +433,11 @@ int main(int argc, char **argv) | |||
454 | free(error); | 433 | free(error); |
455 | } else { | 434 | } else { |
456 | printf("unexpected result:\n"); | 435 | printf("unexpected result:\n"); |
457 | if (xml_mode) { | 436 | plist_write_to_stream(result, stdout, (xml_mode) ? PLIST_FORMAT_XML : PLIST_FORMAT_LIMD, 0); |
458 | print_xml(result); | ||
459 | } else { | ||
460 | plist_print_to_stream(result, stdout); | ||
461 | } | ||
462 | } | 437 | } |
463 | 438 | ||
464 | } else { | 439 | } else { |
465 | if (xml_mode) { | 440 | plist_write_to_stream(result, stdout, (xml_mode) ? PLIST_FORMAT_XML : PLIST_FORMAT_LIMD, 0); |
466 | print_xml(result); | ||
467 | } else { | ||
468 | plist_print_to_stream(result, stdout); | ||
469 | } | ||
470 | } | 441 | } |
471 | } | 442 | } |
472 | } else { | 443 | } else { |