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)
name = strrchr(argv[0], '/');
printf("Usage: %s [OPTIONS] IMAGE_FILE IMAGE_SIGNATURE_FILE\n\n", (name ? name + 1: argv[0]));
printf("Mounts the specified disk image on the device.\n\n");
- printf(" -u, --udid UDID\ttarget specific device by its 40-digit device UDID\n");
+ printf(" -u, --udid UDID\ttarget specific device by UDID\n");
printf(" -l, --list\t\tList mount information\n");
printf(" -t, --imagetype\tImage type to use, default is 'Developer'\n");
printf(" -x, --xml\t\tUse XML output\n");
@@ -76,19 +76,18 @@ static void print_usage(int argc, char **argv)
static void parse_opts(int argc, char **argv)
{
static struct option longopts[] = {
- {"help", 0, NULL, 'h'},
- {"udid", 0, NULL, 'u'},
- {"list", 0, NULL, 'l'},
- {"imagetype", 0, NULL, 't'},
- {"xml", 0, NULL, 'x'},
- {"debug", 0, NULL, 'd'},
+ {"help", no_argument, NULL, 'h'},
+ {"udid", required_argument, NULL, 'u'},
+ {"list", no_argument, NULL, 'l'},
+ {"imagetype", required_argument, NULL, 't'},
+ {"xml", no_argument, NULL, 'x'},
+ {"debug", no_argument, NULL, 'd'},
{NULL, 0, NULL, 0}
};
int c;
while (1) {
- c = getopt_long(argc, argv, "hu:lt:xd", longopts,
- (int *) 0);
+ c = getopt_long(argc, argv, "hu:lt:xd", longopts, NULL);
if (c == -1) {
break;
}
@@ -98,14 +97,12 @@ static void parse_opts(int argc, char **argv)
print_usage(argc, argv);
exit(0);
case 'u':
- if (strlen(optarg) != 40) {
- printf("%s: invalid UDID specified (length != 40)\n",
- argv[0]);
+ if (!*optarg) {
+ fprintf(stderr, "ERROR: UDID must not be empty!\n");
print_usage(argc, argv);
exit(2);
}
- if (udid)
- free(udid);
+ free(udid);
udid = strdup(optarg);
break;
case 'l':