diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/idevicebackup.c | 23 | ||||
-rw-r--r-- | tools/idevicebackup2.c | 9 | ||||
-rw-r--r-- | tools/idevicecrashreport.c | 2 | ||||
-rw-r--r-- | tools/ideviceimagemounter.c | 41 | ||||
-rw-r--r-- | tools/ideviceinfo.c | 6 | ||||
-rw-r--r-- | tools/idevicepair.c | 5 | ||||
-rw-r--r-- | tools/ideviceprovision.c | 4 |
7 files changed, 31 insertions, 59 deletions
diff --git a/tools/idevicebackup.c b/tools/idevicebackup.c index 2856fda..1684666 100644 --- a/tools/idevicebackup.c +++ b/tools/idevicebackup.c @@ -57,6 +57,7 @@ #include <libimobiledevice/notification_proxy.h> #include <libimobiledevice/afc.h> #include <libimobiledevice-glue/utils.h> +#include <plist/plist.h> #define MOBILEBACKUP_SERVICE_NAME "com.apple.mobilebackup" #define NP_SERVICE_NAME "com.apple.mobile.notification_proxy" @@ -317,7 +318,7 @@ static void mobilebackup_write_status(const char *path, int status) if (stat(file_path, &st) == 0) remove(file_path); - plist_write_to_filename(status_plist, file_path, PLIST_FORMAT_XML); + plist_write_to_file(status_plist, file_path, PLIST_FORMAT_XML, 0); plist_free(status_plist); status_plist = NULL; @@ -331,7 +332,7 @@ static int mobilebackup_read_status(const char *path) plist_t status_plist = NULL; char *file_path = mobilebackup_build_path(path, "Status", ".plist"); - plist_read_from_filename(&status_plist, file_path); + plist_read_from_file(file_path, &status_plist, NULL); free(file_path); if (!status_plist) { printf("Could not read Status.plist!\n"); @@ -454,7 +455,7 @@ static int mobilebackup_check_file_integrity(const char *backup_directory, const } infopath = mobilebackup_build_path(backup_directory, hash, ".mdinfo"); - plist_read_from_filename(&mdinfo, infopath); + plist_read_from_file(infopath, &mdinfo, NULL); free(infopath); if (!mdinfo) { printf("\r\n"); @@ -882,7 +883,7 @@ int main(int argc, char *argv[]) /* verify existing Info.plist */ if (stat(info_path, &st) == 0) { printf("Reading Info.plist from backup.\n"); - plist_read_from_filename(&info_plist, info_path); + plist_read_from_file(info_path, &info_plist, NULL); if (!info_plist) { printf("Could not read Info.plist\n"); @@ -893,7 +894,7 @@ int main(int argc, char *argv[]) /* update the last backup time within Info.plist */ mobilebackup_info_update_last_backup_date(info_plist); remove(info_path); - plist_write_to_filename(info_plist, info_path, PLIST_FORMAT_XML); + plist_write_to_file(info_plist, info_path, PLIST_FORMAT_XML, 0); } else { printf("Aborting backup. Backup is not compatible with the current device.\n"); cmd = CMD_LEAVE; @@ -959,7 +960,7 @@ int main(int argc, char *argv[]) /* read the last Manifest.plist */ if (!is_full_backup) { printf("Reading existing Manifest.\n"); - plist_read_from_filename(&manifest_plist, manifest_path); + plist_read_from_file(manifest_path, &manifest_plist, NULL); if (!manifest_plist) { printf("Could not read Manifest.plist, switching to full backup mode.\n"); is_full_backup = 1; @@ -977,7 +978,7 @@ int main(int argc, char *argv[]) remove(info_path); printf("Creating Info.plist for new backup.\n"); info_plist = mobilebackup_factory_info_plist_new(udid); - plist_write_to_filename(info_plist, info_path, PLIST_FORMAT_XML); + plist_write_to_file(info_plist, info_path, PLIST_FORMAT_XML, 0); } free(info_path); @@ -1116,7 +1117,7 @@ int main(int argc, char *argv[]) remove(filename_mdinfo); node = plist_dict_get_item(node_tmp, "BackupFileInfo"); - plist_write_to_filename(node, filename_mdinfo, PLIST_FORMAT_BINARY); + plist_write_to_file(node, filename_mdinfo, PLIST_FORMAT_BINARY, 0); free(filename_mdinfo); } @@ -1228,7 +1229,7 @@ files_out: if (manifest_plist) { remove(manifest_path); printf("Storing Manifest.plist...\n"); - plist_write_to_filename(manifest_plist, manifest_path, PLIST_FORMAT_XML); + plist_write_to_file(manifest_plist, manifest_path, PLIST_FORMAT_XML, 0); } backup_ok = 1; @@ -1259,7 +1260,7 @@ files_out: } /* now make sure backup integrity is ok! verify all files */ printf("Reading existing Manifest.\n"); - plist_read_from_filename(&manifest_plist, manifest_path); + plist_read_from_file(manifest_path, &manifest_plist, NULL); if (!manifest_plist) { printf("Could not read Manifest.plist. Aborting.\n"); break; @@ -1386,7 +1387,7 @@ files_out: while (node) { /* TODO: read mddata/mdinfo files and send to device using DLSendFile */ file_info_path = mobilebackup_build_path(backup_directory, hash, ".mdinfo"); - plist_read_from_filename(&file_info, file_info_path); + plist_read_from_file(file_info_path, &file_info, NULL); /* get encryption state */ tmp_node = plist_dict_get_item(file_info, "IsEncrypted"); diff --git a/tools/idevicebackup2.c b/tools/idevicebackup2.c index 82dc90d..c73b269 100644 --- a/tools/idevicebackup2.c +++ b/tools/idevicebackup2.c @@ -47,6 +47,7 @@ #include <libimobiledevice/sbservices.h> #include <libimobiledevice/diagnostics_relay.h> #include <libimobiledevice-glue/utils.h> +#include <plist/plist.h> #include <endianness.h> @@ -606,7 +607,7 @@ static int mb2_status_check_snapshot_state(const char *path, const char *udid, c plist_t status_plist = NULL; char *file_path = string_build_path(path, udid, "Status.plist", NULL); - plist_read_from_filename(&status_plist, file_path); + plist_read_from_file(file_path, &status_plist, NULL); free(file_path); if (!status_plist) { printf("Could not read Status.plist!\n"); @@ -1780,7 +1781,7 @@ int main(int argc, char *argv[]) free(info_path); } plist_t manifest_plist = NULL; - plist_read_from_filename(&manifest_plist, manifest_path); + plist_read_from_file(manifest_path, &manifest_plist, NULL); if (!manifest_plist) { idevice_free(device); free(info_path); @@ -1936,7 +1937,7 @@ int main(int argc, char *argv[]) /* verify existing Info.plist */ if (info_path && (stat(info_path, &st) == 0) && cmd != CMD_CLOUD) { PRINT_VERBOSE(1, "Reading Info.plist from backup.\n"); - plist_read_from_filename(&info_plist, info_path); + plist_read_from_file(info_path, &info_plist, NULL); if (!info_plist) { printf("Could not read Info.plist\n"); @@ -2030,7 +2031,7 @@ checkpoint: cmd = CMD_LEAVE; } remove_file(info_path); - plist_write_to_filename(info_plist, info_path, PLIST_FORMAT_XML); + plist_write_to_file(info_plist, info_path, PLIST_FORMAT_XML, 0); free(info_path); plist_free(info_plist); diff --git a/tools/idevicecrashreport.c b/tools/idevicecrashreport.c index d0d2147..484212e 100644 --- a/tools/idevicecrashreport.c +++ b/tools/idevicecrashreport.c @@ -81,7 +81,7 @@ static int extract_raw_crash_report(const char* filename) strcpy(p, ".crash"); /* read plist crash report */ - if (plist_read_from_filename(&report, filename)) { + if (plist_read_from_file(filename, &report, NULL)) { plist_t description_node = plist_dict_get_item(report, "description"); if (description_node && plist_get_node_type(description_node) == PLIST_STRING) { plist_get_string_val(description_node, &raw); 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 { diff --git a/tools/ideviceinfo.c b/tools/ideviceinfo.c index fc0527d..fd45763 100644 --- a/tools/ideviceinfo.c +++ b/tools/ideviceinfo.c @@ -37,7 +37,7 @@ #include <libimobiledevice/libimobiledevice.h> #include <libimobiledevice/lockdown.h> -#include <libimobiledevice-glue/utils.h> +#include <plist/plist.h> #define FORMAT_KEY_VALUE 1 #define FORMAT_XML 2 @@ -241,11 +241,11 @@ int main(int argc, char *argv[]) free(xml_doc); break; case FORMAT_KEY_VALUE: - plist_print_to_stream(node, stdout); + plist_write_to_stream(node, stdout, PLIST_FORMAT_LIMD, 0); break; default: if (key != NULL) - plist_print_to_stream(node, stdout); + plist_write_to_stream(node, stdout, PLIST_FORMAT_LIMD, 0); break; } plist_free(node); diff --git a/tools/idevicepair.c b/tools/idevicepair.c index dda02ec..94d3f04 100644 --- a/tools/idevicepair.c +++ b/tools/idevicepair.c @@ -41,7 +41,6 @@ #endif #include "common/userpref.h" -#include <libimobiledevice-glue/utils.h> #include <libimobiledevice/libimobiledevice.h> #include <libimobiledevice/lockdown.h> @@ -104,7 +103,7 @@ static void pairing_cb(lockdownd_cu_pairing_cb_type_t cb_type, void *user_data, printf("\n"); } else if (cb_type == LOCKDOWN_CU_PAIRING_DEVICE_INFO) { printf("Device info:\n"); - plist_print_to_stream_with_indentation((plist_t)data_ptr, stdout, 2); + plist_write_to_stream((plist_t)data_ptr, stdout, PLIST_FORMAT_LIMD, PLIST_OPT_INDENT | PLIST_OPT_INDENT_BY(2)); } else if (cb_type == LOCKDOWN_CU_PAIRING_ERROR) { printf("ERROR: %s\n", (data_ptr) ? (char*)data_ptr : "(unknown)"); } @@ -257,7 +256,7 @@ int main(int argc, char **argv) goto leave; } if (*optarg == '@') { - plist_read_from_filename(&host_info_plist, optarg+1); + plist_read_from_file(optarg+1, &host_info_plist, NULL); if (!host_info_plist) { fprintf(stderr, "ERROR: Could not read from file '%s'\n", optarg+1); result = EXIT_FAILURE; diff --git a/tools/ideviceprovision.c b/tools/ideviceprovision.c index 7cd4f3f..4080a28 100644 --- a/tools/ideviceprovision.c +++ b/tools/ideviceprovision.c @@ -45,7 +45,7 @@ #include <libimobiledevice/libimobiledevice.h> #include <libimobiledevice/lockdown.h> #include <libimobiledevice/misagent.h> -#include <libimobiledevice-glue/utils.h> +#include <plist/plist.h> static void print_usage(int argc, char **argv, int is_error) { @@ -436,7 +436,7 @@ int main(int argc, char *argv[]) } } else { if (pl && (plist_get_node_type(pl) == PLIST_DICT)) { - plist_print_to_stream(pl, stdout); + plist_write_to_stream(pl, stdout, PLIST_FORMAT_LIMD, 0); } else { fprintf(stderr, "ERROR: unexpected node type in profile plist (not PLIST_DICT)\n"); res = -1; |