summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/idevicename.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/tools/idevicename.c b/tools/idevicename.c
index 8b45626..cd8faff 100644
--- a/tools/idevicename.c
+++ b/tools/idevicename.c
@@ -31,7 +31,10 @@
31static void print_usage() 31static void print_usage()
32{ 32{
33 printf("\nUsage: idevicename [OPTIONS] [NAME]\n"); 33 printf("\nUsage: idevicename [OPTIONS] [NAME]\n");
34 printf("Display the device name or set it to NAME if specified.\n");
35 printf("\n");
34 printf(" --udid|-u UDID use UDID to target a specific device\n"); 36 printf(" --udid|-u UDID use UDID to target a specific device\n");
37 printf(" --help|-h print usage information\n");
35 printf("\n"); 38 printf("\n");
36} 39}
37 40
@@ -44,16 +47,21 @@ int main(int argc, char** argv)
44 int optidx = 0; 47 int optidx = 0;
45 const struct option longopts[] = { 48 const struct option longopts[] = {
46 { "udid", required_argument, NULL, 'u' }, 49 { "udid", required_argument, NULL, 'u' },
50 { "help", no_argument, NULL, 'h' },
47 { NULL, 0, NULL, 0} 51 { NULL, 0, NULL, 0}
48 }; 52 };
49 53
50 while ((c = getopt_long(argc, argv, "u:", longopts, &optidx)) != -1) { 54 while ((c = getopt_long(argc, argv, "u:h", longopts, &optidx)) != -1) {
51 switch (c) { 55 switch (c) {
52 case 'u': 56 case 'u':
53 udid = strdup(optarg); 57 udid = strdup(optarg);
54 break; 58 break;
59 case 'h':
60 print_usage();
61 return 0;
55 default: 62 default:
56 break; 63 print_usage();
64 return -1;
57 } 65 }
58 } 66 }
59 67