diff options
author | Nikias Bassen | 2023-04-21 16:51:26 +0200 |
---|---|---|
committer | Nikias Bassen | 2023-04-21 16:51:26 +0200 |
commit | eda2c5ea71829f11d69342e6858d09aa53943938 (patch) | |
tree | 8bb010c65bb4a1f36cc032a2b40d7d27d414a21d /tools/ideviceimagemounter.c | |
parent | 963083be85688206fe52042e8e32602d8139726e (diff) | |
download | libimobiledevice-eda2c5ea71829f11d69342e6858d09aa53943938.tar.gz libimobiledevice-eda2c5ea71829f11d69342e6858d09aa53943938.tar.bz2 |
Updated to use latest libplist API changes
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 @@ #include <libimobiledevice/notification_proxy.h> #include <libimobiledevice/mobile_image_mounter.h> #include <asprintf.h> -#include <libimobiledevice-glue/utils.h> +#include <plist/plist.h> static int list_mode = 0; static int use_network = 0; @@ -143,15 +143,6 @@ static void parse_opts(int argc, char **argv) } } -static void print_xml(plist_t node) -{ - char *xml = NULL; - uint32_t len = 0; - plist_to_xml(node, &xml, &len); - if (xml) - puts(xml); -} - static ssize_t mim_upload_cb(void* buf, size_t size, void* userdata) { return fread(buf, 1, size, (FILE*)userdata); @@ -297,11 +288,7 @@ int main(int argc, char **argv) err = mobile_image_mounter_lookup_image(mim, imagetype, &result); if (err == MOBILE_IMAGE_MOUNTER_E_SUCCESS) { res = 0; - if (xml_mode) { - print_xml(result); - } else { - plist_print_to_stream(result, stdout); - } + plist_write_to_stream(result, stdout, (xml_mode) ? PLIST_FORMAT_XML : PLIST_FORMAT_LIMD, 0); } else { printf("Error: lookup_image returned %d\n", err); } @@ -429,20 +416,12 @@ int main(int argc, char **argv) res = 0; } else { printf("unexpected status value:\n"); - if (xml_mode) { - print_xml(result); - } else { - plist_print_to_stream(result, stdout); - } + plist_write_to_stream(result, stdout, (xml_mode) ? PLIST_FORMAT_XML : PLIST_FORMAT_LIMD, 0); } free(status); } else { printf("unexpected result:\n"); - if (xml_mode) { - print_xml(result); - } else { - plist_print_to_stream(result, stdout); - } + plist_write_to_stream(result, stdout, (xml_mode) ? PLIST_FORMAT_XML : PLIST_FORMAT_LIMD, 0); } } node = plist_dict_get_item(result, "Error"); @@ -454,19 +433,11 @@ int main(int argc, char **argv) free(error); } else { printf("unexpected result:\n"); - if (xml_mode) { - print_xml(result); - } else { - plist_print_to_stream(result, stdout); - } + plist_write_to_stream(result, stdout, (xml_mode) ? PLIST_FORMAT_XML : PLIST_FORMAT_LIMD, 0); } } else { - if (xml_mode) { - print_xml(result); - } else { - plist_print_to_stream(result, stdout); - } + plist_write_to_stream(result, stdout, (xml_mode) ? PLIST_FORMAT_XML : PLIST_FORMAT_LIMD, 0); } } } else { |