summaryrefslogtreecommitdiffstats
path: root/tools/afcclient.c
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2024-02-01 00:57:28 +0100
committerGravatar Nikias Bassen2024-02-01 00:57:28 +0100
commit3c88fafdb79070bd714347d822bb1e034ea76254 (patch)
tree8d25bba653ec0de0baa24e1bf7986f9c85cceca1 /tools/afcclient.c
parent0bdef85018d0ce1294261ab6e11697b041657557 (diff)
downloadlibimobiledevice-3c88fafdb79070bd714347d822bb1e034ea76254.tar.gz
libimobiledevice-3c88fafdb79070bd714347d822bb1e034ea76254.tar.bz2
tools/afcclient: Print human readable description of AFC error code on error
Diffstat (limited to 'tools/afcclient.c')
-rw-r--r--tools/afcclient.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/tools/afcclient.c b/tools/afcclient.c
index 81dc5c5..3975b31 100644
--- a/tools/afcclient.c
+++ b/tools/afcclient.c
@@ -319,7 +319,7 @@ static void handle_devinfo(afc_client_t afc, int argc, char** argv)
319 printf("%s: %s\n", info[i], info[i+1]); 319 printf("%s: %s\n", info[i], info[i+1]);
320 } 320 }
321 } else { 321 } else {
322 printf("Error: Failed to get device info: %d\n", err); 322 printf("Error: Failed to get device info: %s (%d)\n", afc_strerror(err), err);
323 } 323 }
324 afc_dictionary_free(info); 324 afc_dictionary_free(info);
325} 325}
@@ -390,7 +390,7 @@ static void handle_file_info(afc_client_t afc, int argc, char** argv)
390 printf("%s: %s\n", info[i], info[i+1]); 390 printf("%s: %s\n", info[i], info[i+1]);
391 } 391 }
392 } else { 392 } else {
393 printf("Error: Failed to get file info for %s: %d\n", argv[0], err); 393 printf("Error: Failed to get file info for %s: %s (%d)\n", argv[0], afc_strerror(err), err);
394 } 394 }
395 afc_dictionary_free(info); 395 afc_dictionary_free(info);
396 free(abspath); 396 free(abspath);
@@ -481,7 +481,7 @@ static void handle_list(afc_client_t afc, int argc, char** argv)
481 print_file_info(afc, abspath, list_verbose); 481 print_file_info(afc, abspath, list_verbose);
482 return; 482 return;
483 } else if (err != AFC_E_SUCCESS) { 483 } else if (err != AFC_E_SUCCESS) {
484 printf("Error: Failed to list '%s': %d\n", path, err); 484 printf("Error: Failed to list '%s': %s (%d)\n", path, afc_strerror(err), err);
485 free(abspath); 485 free(abspath);
486 return; 486 return;
487 } 487 }
@@ -526,7 +526,7 @@ static void handle_rename(afc_client_t afc, int argc, char** argv)
526 } 526 }
527 afc_error_t err = afc_rename_path(afc, srcpath, dstpath); 527 afc_error_t err = afc_rename_path(afc, srcpath, dstpath);
528 if (err != AFC_E_SUCCESS) { 528 if (err != AFC_E_SUCCESS) {
529 printf("Error: Failed to rename '%s' -> '%s': %d\n", argv[0], argv[1], err); 529 printf("Error: Failed to rename '%s' -> '%s': %s (%d)\n", argv[0], argv[1], afc_strerror(err), err);
530 } 530 }
531 free(srcpath); 531 free(srcpath);
532 free(dstpath); 532 free(dstpath);
@@ -542,7 +542,7 @@ static void handle_mkdir(afc_client_t afc, int argc, char** argv)
542 } 542 }
543 afc_error_t err = afc_make_directory(afc, abspath); 543 afc_error_t err = afc_make_directory(afc, abspath);
544 if (err != AFC_E_SUCCESS) { 544 if (err != AFC_E_SUCCESS) {
545 printf("Error: Failed to create directory '%s': %d\n", argv[i], err); 545 printf("Error: Failed to create directory '%s': %s (%d)\n", argv[i], afc_strerror(err), err);
546 } 546 }
547 free(abspath); 547 free(abspath);
548 } 548 }
@@ -572,7 +572,7 @@ static void handle_link(afc_client_t afc, int argc, char** argv)
572 } 572 }
573 afc_error_t err = afc_make_link(afc, link_type, argv[0], link_name); 573 afc_error_t err = afc_make_link(afc, link_type, argv[0], link_name);
574 if (err != AFC_E_SUCCESS) { 574 if (err != AFC_E_SUCCESS) {
575 printf("Error: Failed to create %s link for '%s' at '%s': %d\n", (link_type == AFC_HARDLINK) ? "hard" : "symbolic", argv[0], link_name, err); 575 printf("Error: Failed to create %s link for '%s' at '%s': %s (%d)\n", (link_type == AFC_HARDLINK) ? "hard" : "symbolic", argv[0], link_name, afc_strerror(err), err);
576 } 576 }
577} 577}
578 578
@@ -586,7 +586,7 @@ static void handle_remove(afc_client_t afc, int argc, char** argv)
586 } 586 }
587 afc_error_t err = afc_remove_path(afc, abspath); 587 afc_error_t err = afc_remove_path(afc, abspath);
588 if (err != AFC_E_SUCCESS) { 588 if (err != AFC_E_SUCCESS) {
589 printf("Error: Failed to remove '%s': %d\n", argv[i], err); 589 printf("Error: Failed to remove '%s': %s (%d)\n", argv[i], afc_strerror(err), err);
590 } 590 }
591 free(abspath); 591 free(abspath);
592 } 592 }
@@ -627,7 +627,7 @@ static void handle_get(afc_client_t afc, int argc, char** argv)
627 if (err != AFC_E_SUCCESS) { 627 if (err != AFC_E_SUCCESS) {
628 free(srcpath); 628 free(srcpath);
629 free(dstpath); 629 free(dstpath);
630 printf("Error: Failed to open file '%s': %d\n", argv[0], err); 630 printf("Error: Failed to open file '%s': %s (%d)\n", argv[0], afc_strerror(err), err);
631 return; 631 return;
632 } 632 }
633 FILE *f = fopen(dstpath, "wb"); 633 FILE *f = fopen(dstpath, "wb");
@@ -687,7 +687,7 @@ static void handle_get(afc_client_t afc, int argc, char** argv)
687 printf("\n"); 687 printf("\n");
688 } 688 }
689 if (err != AFC_E_SUCCESS) { 689 if (err != AFC_E_SUCCESS) {
690 printf("Error: Failed to read from file '%s': %d\n", argv[0], err); 690 printf("Error: Failed to read from file '%s': %s (%d)\n", argv[0], afc_strerror(err), err);
691 } 691 }
692 free(buf); 692 free(buf);
693 fclose(f); 693 fclose(f);
@@ -727,7 +727,7 @@ static void handle_put(afc_client_t afc, int argc, char** argv)
727 err = afc_file_open(afc, dstpath, AFC_FOPEN_RW, &fh); 727 err = afc_file_open(afc, dstpath, AFC_FOPEN_RW, &fh);
728 } 728 }
729 if (err != AFC_E_SUCCESS) { 729 if (err != AFC_E_SUCCESS) {
730 printf("Error: Failed to open file '%s' on device: %d\n", argv[1], err); 730 printf("Error: Failed to open file '%s' on device: %s (%d)\n", argv[1], afc_strerror(err), err);
731 } else { 731 } else {
732 struct timeval t1; 732 struct timeval t1;
733 struct timeval t2; 733 struct timeval t2;
@@ -841,7 +841,7 @@ static void handle_cd(afc_client_t afc, int argc, char** argv)
841 } 841 }
842 afc_dictionary_free(info); 842 afc_dictionary_free(info);
843 } else { 843 } else {
844 printf("Error: Failed to get file info for %s: %d\n", path, err); 844 printf("Error: Failed to get file info for %s: %s (%d)\n", path, afc_strerror(err), err);
845 free(path); 845 free(path);
846 return; 846 return;
847 } 847 }