summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/idevice_id.c6
-rw-r--r--tools/idevicebackup.c4
-rw-r--r--tools/idevicebackup2.c6
-rw-r--r--tools/idevicecrashreport.c4
-rw-r--r--tools/idevicedate.c4
-rw-r--r--tools/idevicedebug.c4
-rw-r--r--tools/idevicedebugserverproxy.c4
-rw-r--r--tools/idevicediagnostics.c4
-rw-r--r--tools/ideviceenterrecovery.c4
-rw-r--r--tools/ideviceimagemounter.c25
-rw-r--r--tools/ideviceinfo.c4
-rw-r--r--tools/idevicename.c8
-rw-r--r--tools/idevicenotificationproxy.c4
-rw-r--r--tools/idevicepair.c12
-rw-r--r--tools/ideviceprovision.c4
-rw-r--r--tools/idevicescreenshot.c4
-rw-r--r--tools/idevicesyslog.c4
17 files changed, 54 insertions, 51 deletions
diff --git a/tools/idevice_id.c b/tools/idevice_id.c
index 6f020ff..558dcbe 100644
--- a/tools/idevice_id.c
+++ b/tools/idevice_id.c
@@ -40,7 +40,7 @@ static void print_usage(int argc, char **argv)
name = strrchr(argv[0], '/');
printf("Usage: %s [OPTIONS] [UDID]\n", (name ? name + 1: argv[0]));
printf("Prints device name or a list of attached devices.\n\n");
- printf(" The UDID is a 40-digit hexadecimal number of the device\n");
+ printf(" UDID is the unique device identifier of the device\n");
printf(" for which the name should be retrieved.\n\n");
printf(" -l, --list\t\tlist UDID of all attached devices\n");
printf(" -d, --debug\t\tenable communication debugging\n");
@@ -79,7 +79,7 @@ int main(int argc, char **argv)
/* check if udid was passed */
if (mode == MODE_SHOW_ID) {
i--;
- if (!argv[i] || (strlen(argv[i]) != 40)) {
+ if (argc < 2 || !argv[i] || !*argv[i]) {
print_usage(argc, argv);
return 0;
}
@@ -90,7 +90,7 @@ int main(int argc, char **argv)
case MODE_SHOW_ID:
idevice_new(&device, udid);
if (!device) {
- fprintf(stderr, "ERROR: No device with UDID=%s attached.\n", udid);
+ fprintf(stderr, "ERROR: No device with UDID %s attached.\n", udid);
return -2;
}
diff --git a/tools/idevicebackup.c b/tools/idevicebackup.c
index 7e825de..cd69bcc 100644
--- a/tools/idevicebackup.c
+++ b/tools/idevicebackup.c
@@ -671,7 +671,7 @@ static void print_usage(int argc, char **argv)
printf(" restore\tRestores a device backup from DIRECTORY.\n\n");
printf("options:\n");
printf(" -d, --debug\t\tenable communication debugging\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(" -h, --help\t\tprints usage information\n");
printf("\n");
printf("Homepage: <" PACKAGE_URL ">\n");
@@ -715,7 +715,7 @@ int main(int argc, char *argv[])
}
else if (!strcmp(argv[i], "-u") || !strcmp(argv[i], "--udid")) {
i++;
- if (!argv[i] || (strlen(argv[i]) != 40)) {
+ if (!argv[i] || !*argv[i]) {
print_usage(argc, argv);
return 0;
}
diff --git a/tools/idevicebackup2.c b/tools/idevicebackup2.c
index 7fb67df..6d4785b 100644
--- a/tools/idevicebackup2.c
+++ b/tools/idevicebackup2.c
@@ -1323,7 +1323,7 @@ static void print_usage(int argc, char **argv)
printf("\n");
printf("options:\n");
printf(" -d, --debug\t\tenable communication debugging\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(" -s, --source UDID\tuse backup data from device specified by UDID\n");
printf(" -i, --interactive\trequest passwords interactively\n");
printf(" -h, --help\t\tprints usage information\n");
@@ -1369,7 +1369,7 @@ int main(int argc, char *argv[])
}
else if (!strcmp(argv[i], "-u") || !strcmp(argv[i], "--udid")) {
i++;
- if (!argv[i] || (strlen(argv[i]) != 40)) {
+ if (!argv[i] || !*argv[i]) {
print_usage(argc, argv);
return -1;
}
@@ -1378,7 +1378,7 @@ int main(int argc, char *argv[])
}
else if (!strcmp(argv[i], "-s") || !strcmp(argv[i], "--source")) {
i++;
- if (!argv[i] || (strlen(argv[i]) != 40)) {
+ if (!argv[i] || !*argv[i]) {
print_usage(argc, argv);
return -1;
}
diff --git a/tools/idevicecrashreport.c b/tools/idevicecrashreport.c
index 4d7f41c..e05d506 100644
--- a/tools/idevicecrashreport.c
+++ b/tools/idevicecrashreport.c
@@ -301,7 +301,7 @@ static void print_usage(int argc, char **argv)
printf(" -e, --extract\t\textract raw crash report into separate '.crash' file\n");
printf(" -k, --keep\t\tcopy but do not remove crash reports from device\n");
printf(" -d, --debug\t\tenable communication debugging\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(" -h, --help\t\tprints usage information\n");
printf("\n");
printf("Homepage: <" PACKAGE_URL ">\n");
@@ -327,7 +327,7 @@ int main(int argc, char* argv[]) {
}
else if (!strcmp(argv[i], "-u") || !strcmp(argv[i], "--udid")) {
i++;
- if (!argv[i] || (strlen(argv[i]) != 40)) {
+ if (!argv[i] || !*argv[i]) {
print_usage(argc, argv);
return 0;
}
diff --git a/tools/idevicedate.c b/tools/idevicedate.c
index 97243bb..2676880 100644
--- a/tools/idevicedate.c
+++ b/tools/idevicedate.c
@@ -50,7 +50,7 @@ static void print_usage(int argc, char **argv)
printf("NOTE: Setting the time on iOS 6 and later is only supported\n");
printf(" in the setup wizard screens before device activation.\n\n");
printf(" -d, --debug\t\tenable communication debugging\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(" -s, --set TIMESTAMP\tset UTC time described by TIMESTAMP\n");
printf(" -c, --sync\t\tset time of device to current system time\n");
printf(" -h, --help\t\tprints usage information\n");
@@ -84,7 +84,7 @@ int main(int argc, char *argv[])
}
else if (!strcmp(argv[i], "-u") || !strcmp(argv[i], "--udid")) {
i++;
- if (!argv[i] || (strlen(argv[i]) != 40)) {
+ if (!argv[i] || !*argv[i]) {
print_usage(argc, argv);
return 0;
}
diff --git a/tools/idevicedebug.c b/tools/idevicedebug.c
index f18254a..c7508e3 100644
--- a/tools/idevicedebug.c
+++ b/tools/idevicedebug.c
@@ -188,7 +188,7 @@ static void print_usage(int argc, char **argv)
printf("\n");
printf(" The following OPTIONS are accepted:\n");
printf(" -e, --env NAME=VALUE\tset environment variable NAME to VALUE\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(" -d, --debug\t\tenable communication debugging\n");
printf(" -h, --help\t\tprints usage information\n");
printf("\n");
@@ -233,7 +233,7 @@ int main(int argc, char *argv[])
continue;
} else if (!strcmp(argv[i], "-u") || !strcmp(argv[i], "--udid")) {
i++;
- if (!argv[i] || (strlen(argv[i]) != 40)) {
+ if (!argv[i] || !*argv[i]) {
print_usage(argc, argv);
res = 0;
goto cleanup;
diff --git a/tools/idevicedebugserverproxy.c b/tools/idevicedebugserverproxy.c
index 56b1013..0b0419b 100644
--- a/tools/idevicedebugserverproxy.c
+++ b/tools/idevicedebugserverproxy.c
@@ -71,7 +71,7 @@ static void print_usage(int argc, char **argv)
printf("Usage: %s [OPTIONS] <PORT>\n", (name ? name + 1: argv[0]));
printf("Proxy debugserver connection from device to a local socket at PORT.\n\n");
printf(" -d, --debug\t\tenable communication debugging\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(" -h, --help\t\tprints usage information\n");
printf("\n");
printf("Homepage: <" PACKAGE_URL ">\n");
@@ -280,7 +280,7 @@ int main(int argc, char *argv[])
}
else if (!strcmp(argv[i], "-u") || !strcmp(argv[i], "--udid")) {
i++;
- if (!argv[i] || (strlen(argv[i]) != 40)) {
+ if (!argv[i] || !*argv[i]) {
print_usage(argc, argv);
return 0;
}
diff --git a/tools/idevicediagnostics.c b/tools/idevicediagnostics.c
index 66e192f..8c32854 100644
--- a/tools/idevicediagnostics.c
+++ b/tools/idevicediagnostics.c
@@ -79,7 +79,7 @@ int main(int argc, char **argv)
}
else if (!strcmp(argv[i], "-u") || !strcmp(argv[i], "--udid")) {
i++;
- if (!argv[i] || (strlen(argv[i]) != 40)) {
+ if (!argv[i] || !*argv[i]) {
print_usage(argc, argv);
result = 0;
goto cleanup;
@@ -318,7 +318,7 @@ void print_usage(int argc, char **argv)
printf(" sleep\t\t\t\tput device into sleep mode (disconnects from host)\n\n");
printf(" The following OPTIONS are accepted:\n");
printf(" -d, --debug\t\tenable communication debugging\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(" -h, --help\t\tprints usage information\n");
printf("\n");
printf("Homepage: <" PACKAGE_URL ">\n");
diff --git a/tools/ideviceenterrecovery.c b/tools/ideviceenterrecovery.c
index 21c4ff6..69484cc 100644
--- a/tools/ideviceenterrecovery.c
+++ b/tools/ideviceenterrecovery.c
@@ -37,7 +37,7 @@ static void print_usage(int argc, char **argv)
name = strrchr(argv[0], '/');
printf("Usage: %s [OPTIONS] UDID\n", (name ? name + 1: argv[0]));
- printf("Makes a device with the supplied 40-digit UDID enter recovery mode immediately.\n\n");
+ printf("Makes a device with the supplied UDID enter recovery mode immediately.\n\n");
printf(" -d, --debug\t\tenable communication debugging\n");
printf(" -h, --help\t\tprints usage information\n");
printf("\n");
@@ -66,7 +66,7 @@ int main(int argc, char *argv[])
}
i--;
- if (!argv[i] || (strlen(argv[i]) != 40)) {
+ if (argc < 2 || !argv[i] || !*argv[i]) {
print_usage(argc, argv);
return 0;
}
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':
diff --git a/tools/ideviceinfo.c b/tools/ideviceinfo.c
index 40bcac6..59fade8 100644
--- a/tools/ideviceinfo.c
+++ b/tools/ideviceinfo.c
@@ -91,7 +91,7 @@ static void print_usage(int argc, char **argv)
printf("Show information about a connected device.\n\n");
printf(" -d, --debug\t\tenable communication debugging\n");
printf(" -s, --simple\t\tuse a simple connection to avoid auto-pairing with the device\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(" -q, --domain NAME\tset domain of query to NAME. Default: None\n");
printf(" -k, --key NAME\tonly query key specified by NAME. Default: All keys.\n");
printf(" -x, --xml\t\toutput information as xml plist instead of key/value pairs\n");
@@ -129,7 +129,7 @@ int main(int argc, char *argv[])
}
else if (!strcmp(argv[i], "-u") || !strcmp(argv[i], "--udid")) {
i++;
- if (!argv[i] || (strlen(argv[i]) != 40)) {
+ if (!argv[i] || !*argv[i]) {
print_usage(argc, argv);
return 0;
}
diff --git a/tools/idevicename.c b/tools/idevicename.c
index 013becc..ef226f7 100644
--- a/tools/idevicename.c
+++ b/tools/idevicename.c
@@ -38,7 +38,7 @@ static void print_usage(void)
printf("Display the device name or set it to NAME if specified.\n");
printf("\n");
printf(" -d, --debug\t\tenable communication debugging\n");
- printf(" -u, --udid UDID\tuse UDID to target a specific device\n");
+ printf(" -u, --udid UDID\ttarget specific device by UDID\n");
printf(" -h, --help\t\tprint usage information\n");
printf("\n");
printf("Homepage: <" PACKAGE_URL ">\n");
@@ -60,6 +60,12 @@ int main(int argc, char** argv)
while ((c = getopt_long(argc, argv, "du:h", longopts, &optidx)) != -1) {
switch (c) {
case 'u':
+ if (!*optarg) {
+ fprintf(stderr, "ERROR: UDID must not be empty!\n");
+ print_usage();
+ exit(2);
+ }
+ free(udid);
udid = strdup(optarg);
break;
case 'h':
diff --git a/tools/idevicenotificationproxy.c b/tools/idevicenotificationproxy.c
index 5e4ac9a..72b406c 100644
--- a/tools/idevicenotificationproxy.c
+++ b/tools/idevicenotificationproxy.c
@@ -70,7 +70,7 @@ static void print_usage(int argc, char **argv)
printf("\n");
printf(" The following OPTIONS are accepted:\n");
printf(" -d, --debug\t\tenable communication debugging\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(" -h, --help\t\tprints usage information\n");
printf("\n");
printf("Homepage: <" PACKAGE_URL ">\n");
@@ -114,7 +114,7 @@ int main(int argc, char *argv[])
}
else if (!strcmp(argv[i], "-u") || !strcmp(argv[i], "--udid")) {
i++;
- if (!argv[i] || (strlen(argv[i]) != 40)) {
+ if (!argv[i] || !*argv[i]) {
print_usage(argc, argv);
result = 0;
goto cleanup;
diff --git a/tools/idevicepair.c b/tools/idevicepair.c
index b6f0751..6ae9103 100644
--- a/tools/idevicepair.c
+++ b/tools/idevicepair.c
@@ -72,7 +72,7 @@ static void print_usage(int argc, char **argv)
printf(" list list devices paired with this host\n\n");
printf(" The following OPTIONS are accepted:\n");
printf(" -d, --debug enable communication debugging\n");
- printf(" -u, --udid UDID target specific device by its 40-digit device UDID\n");
+ printf(" -u, --udid UDID target specific device by UDID\n");
printf(" -h, --help prints usage information\n");
printf("\n");
printf("Homepage: <" PACKAGE_URL ">\n");
@@ -81,9 +81,9 @@ 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", 1, NULL, 'u'},
- {"debug", 0, NULL, 'd'},
+ {"help", no_argument, NULL, 'h'},
+ {"udid", required_argument, NULL, 'u'},
+ {"debug", no_argument, NULL, 'd'},
{NULL, 0, NULL, 0}
};
int c;
@@ -99,8 +99,8 @@ static void parse_opts(int argc, char **argv)
print_usage(argc, argv);
exit(EXIT_SUCCESS);
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);
}
diff --git a/tools/ideviceprovision.c b/tools/ideviceprovision.c
index 0bef7e8..f91ce4f 100644
--- a/tools/ideviceprovision.c
+++ b/tools/ideviceprovision.c
@@ -64,7 +64,7 @@ static void print_usage(int argc, char **argv)
printf(" \tspecified by FILE.\n\n");
printf(" The following OPTIONS are accepted:\n");
printf(" -d, --debug enable communication debugging\n");
- printf(" -u, --udid UDID target specific device by its 40-digit device UDID\n");
+ printf(" -u, --udid UDID target specific device by UDID\n");
printf(" -x, --xml print XML output when using the 'dump' command\n");
printf(" -h, --help prints usage information\n");
printf("\n");
@@ -299,7 +299,7 @@ int main(int argc, char *argv[])
}
else if (!strcmp(argv[i], "-u") || !strcmp(argv[i], "--udid")) {
i++;
- if (!argv[i] || (strlen(argv[i]) != 40)) {
+ if (!argv[i] || !*argv[i]) {
print_usage(argc, argv);
return 0;
}
diff --git a/tools/idevicescreenshot.c b/tools/idevicescreenshot.c
index 74acdf6..f2bcd48 100644
--- a/tools/idevicescreenshot.c
+++ b/tools/idevicescreenshot.c
@@ -55,7 +55,7 @@ int main(int argc, char **argv)
}
else if (!strcmp(argv[i], "-u") || !strcmp(argv[i], "--udid")) {
i++;
- if (!argv[i] || (strlen(argv[i]) != 40)) {
+ if (!argv[i] || !*argv[i]) {
print_usage(argc, argv);
return 0;
}
@@ -158,7 +158,7 @@ void print_usage(int argc, char **argv)
printf("NOTE: A mounted developer disk image is required on the device, otherwise\n");
printf("the screenshotr service is not available.\n\n");
printf(" -d, --debug\t\tenable communication debugging\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(" -h, --help\t\tprints usage information\n");
printf("\n");
printf("Homepage: <" PACKAGE_URL ">\n");
diff --git a/tools/idevicesyslog.c b/tools/idevicesyslog.c
index 0a923b8..76de128 100644
--- a/tools/idevicesyslog.c
+++ b/tools/idevicesyslog.c
@@ -185,7 +185,7 @@ int main(int argc, char *argv[])
}
else if (!strcmp(argv[i], "-u") || !strcmp(argv[i], "--udid")) {
i++;
- if (!argv[i] || (strlen(argv[i]) != 40)) {
+ if (!argv[i] || !*argv[i]) {
print_usage(argc, argv);
return 0;
}
@@ -238,7 +238,7 @@ void print_usage(int argc, char **argv)
printf("Usage: %s [OPTIONS]\n", (name ? name + 1: argv[0]));
printf("Relay syslog of a connected device.\n\n");
printf(" -d, --debug\t\tenable communication debugging\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(" -h, --help\t\tprints usage information\n");
printf("\n");
printf("Homepage: <" PACKAGE_URL ">\n");