summaryrefslogtreecommitdiffstats
path: root/tools/ideviceimagemounter.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/ideviceimagemounter.c')
-rw-r--r--tools/ideviceimagemounter.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/tools/ideviceimagemounter.c b/tools/ideviceimagemounter.c
index d56fa0c..7101c7e 100644
--- a/tools/ideviceimagemounter.c
+++ b/tools/ideviceimagemounter.c
@@ -63,7 +63,7 @@ static void print_usage(int argc, char **argv)
63 name = strrchr(argv[0], '/'); 63 name = strrchr(argv[0], '/');
64 printf("Usage: %s [OPTIONS] IMAGE_FILE IMAGE_SIGNATURE_FILE\n\n", (name ? name + 1: argv[0])); 64 printf("Usage: %s [OPTIONS] IMAGE_FILE IMAGE_SIGNATURE_FILE\n\n", (name ? name + 1: argv[0]));
65 printf("Mounts the specified disk image on the device.\n\n"); 65 printf("Mounts the specified disk image on the device.\n\n");
66 printf(" -u, --udid UDID\ttarget specific device by its 40-digit device UDID\n"); 66 printf(" -u, --udid UDID\ttarget specific device by UDID\n");
67 printf(" -l, --list\t\tList mount information\n"); 67 printf(" -l, --list\t\tList mount information\n");
68 printf(" -t, --imagetype\tImage type to use, default is 'Developer'\n"); 68 printf(" -t, --imagetype\tImage type to use, default is 'Developer'\n");
69 printf(" -x, --xml\t\tUse XML output\n"); 69 printf(" -x, --xml\t\tUse XML output\n");
@@ -76,19 +76,18 @@ static void print_usage(int argc, char **argv)
76static void parse_opts(int argc, char **argv) 76static void parse_opts(int argc, char **argv)
77{ 77{
78 static struct option longopts[] = { 78 static struct option longopts[] = {
79 {"help", 0, NULL, 'h'}, 79 {"help", no_argument, NULL, 'h'},
80 {"udid", 0, NULL, 'u'}, 80 {"udid", required_argument, NULL, 'u'},
81 {"list", 0, NULL, 'l'}, 81 {"list", no_argument, NULL, 'l'},
82 {"imagetype", 0, NULL, 't'}, 82 {"imagetype", required_argument, NULL, 't'},
83 {"xml", 0, NULL, 'x'}, 83 {"xml", no_argument, NULL, 'x'},
84 {"debug", 0, NULL, 'd'}, 84 {"debug", no_argument, NULL, 'd'},
85 {NULL, 0, NULL, 0} 85 {NULL, 0, NULL, 0}
86 }; 86 };
87 int c; 87 int c;
88 88
89 while (1) { 89 while (1) {
90 c = getopt_long(argc, argv, "hu:lt:xd", longopts, 90 c = getopt_long(argc, argv, "hu:lt:xd", longopts, NULL);
91 (int *) 0);
92 if (c == -1) { 91 if (c == -1) {
93 break; 92 break;
94 } 93 }
@@ -98,14 +97,12 @@ static void parse_opts(int argc, char **argv)
98 print_usage(argc, argv); 97 print_usage(argc, argv);
99 exit(0); 98 exit(0);
100 case 'u': 99 case 'u':
101 if (strlen(optarg) != 40) { 100 if (!*optarg) {
102 printf("%s: invalid UDID specified (length != 40)\n", 101 fprintf(stderr, "ERROR: UDID must not be empty!\n");
103 argv[0]);
104 print_usage(argc, argv); 102 print_usage(argc, argv);
105 exit(2); 103 exit(2);
106 } 104 }
107 if (udid) 105 free(udid);
108 free(udid);
109 udid = strdup(optarg); 106 udid = strdup(optarg);
110 break; 107 break;
111 case 'l': 108 case 'l':