summaryrefslogtreecommitdiffstats
path: root/tools/idevice_id.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/idevice_id.c')
-rw-r--r--tools/idevice_id.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/tools/idevice_id.c b/tools/idevice_id.c
index 7987705..7c1b3b4 100644
--- a/tools/idevice_id.c
+++ b/tools/idevice_id.c
@@ -23,6 +23,8 @@
23#include <config.h> 23#include <config.h>
24#endif 24#endif
25 25
26#define TOOL_NAME "idevice_id"
27
26#include <stdio.h> 28#include <stdio.h>
27#include <string.h> 29#include <string.h>
28#include <stdlib.h> 30#include <stdlib.h>
@@ -51,6 +53,7 @@ static void print_usage(int argc, char **argv, int is_error)
51 " -n, --network list UDIDs of all devices available via network\n" \ 53 " -n, --network list UDIDs of all devices available via network\n" \
52 " -d, --debug enable communication debugging\n" \ 54 " -d, --debug enable communication debugging\n" \
53 " -h, --help prints usage information\n" \ 55 " -h, --help prints usage information\n" \
56 " -v, --version prints version information\n" \
54 "\n" \ 57 "\n" \
55 "Homepage: <" PACKAGE_URL ">\n" \ 58 "Homepage: <" PACKAGE_URL ">\n" \
56 "Bug Reports: <" PACKAGE_BUGREPORT ">\n" 59 "Bug Reports: <" PACKAGE_BUGREPORT ">\n"
@@ -76,10 +79,11 @@ int main(int argc, char **argv)
76 { "help", no_argument, NULL, 'h' }, 79 { "help", no_argument, NULL, 'h' },
77 { "list", no_argument, NULL, 'l' }, 80 { "list", no_argument, NULL, 'l' },
78 { "network", no_argument, NULL, 'n' }, 81 { "network", no_argument, NULL, 'n' },
82 { "version", no_argument, NULL, 'v' },
79 { NULL, 0, NULL, 0} 83 { NULL, 0, NULL, 0}
80 }; 84 };
81 85
82 while ((c = getopt_long(argc, argv, "dhln", longopts, NULL)) != -1) { 86 while ((c = getopt_long(argc, argv, "dhlnv", longopts, NULL)) != -1) {
83 switch (c) { 87 switch (c) {
84 case 'd': 88 case 'd':
85 idevice_set_debug_level(1); 89 idevice_set_debug_level(1);
@@ -95,6 +99,9 @@ int main(int argc, char **argv)
95 mode = MODE_LIST_DEVICES; 99 mode = MODE_LIST_DEVICES;
96 include_network = 1; 100 include_network = 1;
97 break; 101 break;
102 case 'v':
103 printf("%s %s\n", TOOL_NAME, PACKAGE_VERSION);
104 return 0;
98 default: 105 default:
99 print_usage(argc, argv, 1); 106 print_usage(argc, argv, 1);
100 exit(EXIT_FAILURE); 107 exit(EXIT_FAILURE);
@@ -117,7 +124,7 @@ int main(int argc, char **argv)
117 return -2; 124 return -2;
118 } 125 }
119 126
120 if (LOCKDOWN_E_SUCCESS != lockdownd_client_new(device, &client, "idevice_id")) { 127 if (LOCKDOWN_E_SUCCESS != lockdownd_client_new(device, &client, TOOL_NAME)) {
121 idevice_free(device); 128 idevice_free(device);
122 fprintf(stderr, "ERROR: Connecting to device failed!\n"); 129 fprintf(stderr, "ERROR: Connecting to device failed!\n");
123 return -2; 130 return -2;