diff options
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/iphoneinfo.c | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/tools/iphoneinfo.c b/tools/iphoneinfo.c index 4d6da31..e0d7693 100644 --- a/tools/iphoneinfo.c +++ b/tools/iphoneinfo.c | |||
| @@ -51,8 +51,8 @@ static const char *domains[] = { | |||
| 51 | 51 | ||
| 52 | int is_domain_known(char *domain); | 52 | int is_domain_known(char *domain); |
| 53 | void print_usage(int argc, char **argv); | 53 | void print_usage(int argc, char **argv); |
| 54 | void plist_node_to_string(plist_t *node); | 54 | void plist_node_to_string(plist_t node); |
| 55 | void plist_children_to_string(plist_t *node); | 55 | void plist_children_to_string(plist_t node); |
| 56 | 56 | ||
| 57 | int main(int argc, char *argv[]) | 57 | int main(int argc, char *argv[]) |
| 58 | { | 58 | { |
| @@ -145,7 +145,7 @@ int main(int argc, char *argv[]) | |||
| 145 | if(lockdownd_get_value(client, domain, key, &node) == LOCKDOWN_E_SUCCESS) | 145 | if(lockdownd_get_value(client, domain, key, &node) == LOCKDOWN_E_SUCCESS) |
| 146 | { | 146 | { |
| 147 | if (plist_get_node_type(node) == PLIST_DICT) { | 147 | if (plist_get_node_type(node) == PLIST_DICT) { |
| 148 | if (plist_get_first_child(node)) | 148 | if (plist_dict_get_size(node)) |
| 149 | { | 149 | { |
| 150 | switch (format) { | 150 | switch (format) { |
| 151 | case FORMAT_XML: | 151 | case FORMAT_XML: |
| @@ -208,7 +208,7 @@ void print_usage(int argc, char **argv) | |||
| 208 | printf("\n"); | 208 | printf("\n"); |
| 209 | } | 209 | } |
| 210 | 210 | ||
| 211 | void plist_node_to_string(plist_t *node) | 211 | void plist_node_to_string(plist_t node) |
| 212 | { | 212 | { |
| 213 | char *s = NULL; | 213 | char *s = NULL; |
| 214 | double d; | 214 | double d; |
| @@ -267,15 +267,26 @@ void plist_node_to_string(plist_t *node) | |||
| 267 | } | 267 | } |
| 268 | } | 268 | } |
| 269 | 269 | ||
| 270 | void plist_children_to_string(plist_t *node) | 270 | void plist_children_to_string(plist_t node) |
| 271 | { | 271 | { |
| 272 | /* iterate over key/value pairs */ | 272 | /* iterate over key/value pairs */ |
| 273 | for ( | 273 | plist_dict_iter it = NULL; |
| 274 | node = plist_get_first_child(node); | 274 | |
| 275 | node != NULL; | 275 | char* key = NULL; |
| 276 | node = plist_get_next_sibling(node) | 276 | plist_t subnode = NULL; |
| 277 | ) { | 277 | plist_dict_new_iter(node, &it); |
| 278 | plist_node_to_string(node); | 278 | plist_dict_next_item(node, it, &key, &subnode); |
| 279 | while (subnode) | ||
| 280 | { | ||
| 281 | subnode = NULL; | ||
| 282 | |||
| 283 | printf("%s: ", key); | ||
| 284 | free(key); | ||
| 285 | key = NULL; | ||
| 286 | plist_node_to_string(subnode); | ||
| 287 | |||
| 288 | plist_dict_next_item(node, it, &key, &subnode); | ||
| 279 | } | 289 | } |
| 290 | free(it); | ||
| 280 | } | 291 | } |
| 281 | 292 | ||
