summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/idevice_id.c11
-rw-r--r--tools/idevicebackup.c13
-rw-r--r--tools/idevicebackup2.c21
-rw-r--r--tools/idevicecrashreport.c11
-rw-r--r--tools/idevicedate.c11
-rw-r--r--tools/idevicedebug.c13
-rw-r--r--tools/idevicedebugserverproxy.c11
-rw-r--r--tools/idevicediagnostics.c12
-rw-r--r--tools/ideviceenterrecovery.c9
-rw-r--r--tools/ideviceimagemounter.c25
-rw-r--r--tools/ideviceinfo.c15
-rw-r--r--tools/idevicename.c24
-rw-r--r--tools/idevicenotificationproxy.c12
-rw-r--r--tools/idevicepair.c28
-rw-r--r--tools/ideviceprovision.c11
-rw-r--r--tools/idevicescreenshot.c11
-rw-r--r--tools/idevicesetlocation.c24
-rw-r--r--tools/idevicesyslog.c11
18 files changed, 198 insertions, 75 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 @@
#include <config.h>
#endif
+#define TOOL_NAME "idevice_id"
+
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@@ -51,6 +53,7 @@ static void print_usage(int argc, char **argv, int is_error)
" -n, --network list UDIDs of all devices available via network\n" \
" -d, --debug enable communication debugging\n" \
" -h, --help prints usage information\n" \
+ " -v, --version prints version information\n" \
"\n" \
"Homepage: <" PACKAGE_URL ">\n" \
"Bug Reports: <" PACKAGE_BUGREPORT ">\n"
@@ -76,10 +79,11 @@ int main(int argc, char **argv)
{ "help", no_argument, NULL, 'h' },
{ "list", no_argument, NULL, 'l' },
{ "network", no_argument, NULL, 'n' },
+ { "version", no_argument, NULL, 'v' },
{ NULL, 0, NULL, 0}
};
- while ((c = getopt_long(argc, argv, "dhln", longopts, NULL)) != -1) {
+ while ((c = getopt_long(argc, argv, "dhlnv", longopts, NULL)) != -1) {
switch (c) {
case 'd':
idevice_set_debug_level(1);
@@ -95,6 +99,9 @@ int main(int argc, char **argv)
mode = MODE_LIST_DEVICES;
include_network = 1;
break;
+ case 'v':
+ printf("%s %s\n", TOOL_NAME, PACKAGE_VERSION);
+ return 0;
default:
print_usage(argc, argv, 1);
exit(EXIT_FAILURE);
@@ -117,7 +124,7 @@ int main(int argc, char **argv)
return -2;
}
- if (LOCKDOWN_E_SUCCESS != lockdownd_client_new(device, &client, "idevice_id")) {
+ if (LOCKDOWN_E_SUCCESS != lockdownd_client_new(device, &client, TOOL_NAME)) {
idevice_free(device);
fprintf(stderr, "ERROR: Connecting to device failed!\n");
return -2;
diff --git a/tools/idevicebackup.c b/tools/idevicebackup.c
index c55301c..171ab7e 100644
--- a/tools/idevicebackup.c
+++ b/tools/idevicebackup.c
@@ -24,6 +24,8 @@
#include <config.h>
#endif
+#define TOOL_NAME "idevicebackup"
+
#include <stdio.h>
#include <string.h>
#include <errno.h>
@@ -606,7 +608,7 @@ static void do_post_notification(const char *notification)
np_client_t np;
if (!client) {
- if (lockdownd_client_new_with_handshake(device, &client, "idevicebackup") != LOCKDOWN_E_SUCCESS) {
+ if (lockdownd_client_new_with_handshake(device, &client, TOOL_NAME) != LOCKDOWN_E_SUCCESS) {
return;
}
}
@@ -673,9 +675,10 @@ static void print_usage(int argc, char **argv)
printf(" restore\tRestores a device backup from DIRECTORY.\n");
printf("\n");
printf("OPTIONS:\n");
- printf(" -d, --debug\t\tenable communication debugging\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(" -v, --version\t\tprints version information\n");
printf("\n");
printf("Homepage: <" PACKAGE_URL ">\n");
printf("Bug Reports: <" PACKAGE_BUGREPORT ">\n");
@@ -730,6 +733,10 @@ int main(int argc, char *argv[])
print_usage(argc, argv);
return 0;
}
+ else if (!strcmp(argv[i], "-v") || !strcmp(argv[i], "--version")) {
+ printf("%s %s\n", TOOL_NAME, PACKAGE_VERSION);
+ return 0;
+ }
else if (!strcmp(argv[i], "backup")) {
cmd = CMD_BACKUP;
}
@@ -792,7 +799,7 @@ int main(int argc, char *argv[])
}
}
- if (LOCKDOWN_E_SUCCESS != (ldret = lockdownd_client_new_with_handshake(device, &client, "idevicebackup"))) {
+ if (LOCKDOWN_E_SUCCESS != (ldret = lockdownd_client_new_with_handshake(device, &client, TOOL_NAME))) {
printf("ERROR: Could not connect to lockdownd, error code %d\n", ldret);
idevice_free(device);
return -1;
diff --git a/tools/idevicebackup2.c b/tools/idevicebackup2.c
index 382efc6..61302cc 100644
--- a/tools/idevicebackup2.c
+++ b/tools/idevicebackup2.c
@@ -24,6 +24,8 @@
#include <config.h>
#endif
+#define TOOL_NAME "idevicebackup2"
+
#include <stdio.h>
#include <string.h>
#include <errno.h>
@@ -346,7 +348,7 @@ static plist_t mobilebackup_factory_info_plist_new(const char* udid, idevice_t d
char *udid_uppercase = NULL;
lockdownd_client_t lockdown = NULL;
- if (lockdownd_client_new_with_handshake(device, &lockdown, "idevicebackup2") != LOCKDOWN_E_SUCCESS) {
+ if (lockdownd_client_new_with_handshake(device, &lockdown, TOOL_NAME) != LOCKDOWN_E_SUCCESS) {
return NULL;
}
@@ -367,7 +369,7 @@ static plist_t mobilebackup_factory_info_plist_new(const char* udid, idevice_t d
plist_t app_dict = plist_new_dict();
plist_t installed_apps = plist_new_array();
instproxy_client_t ip = NULL;
- if (instproxy_client_start_service(device, &ip, "idevicebackup2") == INSTPROXY_E_SUCCESS) {
+ if (instproxy_client_start_service(device, &ip, TOOL_NAME) == INSTPROXY_E_SUCCESS) {
plist_t client_opts = instproxy_client_options_new();
instproxy_client_options_add(client_opts, "ApplicationType", "User", NULL);
instproxy_client_options_set_return_attributes(client_opts, "CFBundleIdentifier", "ApplicationSINF", "iTunesMetadata", NULL);
@@ -376,7 +378,7 @@ static plist_t mobilebackup_factory_info_plist_new(const char* udid, idevice_t d
instproxy_browse(ip, client_opts, &apps);
sbservices_client_t sbs = NULL;
- if (sbservices_client_start_service(device, &sbs, "idevicebackup2") != SBSERVICES_E_SUCCESS) {
+ if (sbservices_client_start_service(device, &sbs, TOOL_NAME) != SBSERVICES_E_SUCCESS) {
printf("Couldn't establish sbservices connection. Continuing anyway.\n");
}
@@ -627,7 +629,7 @@ static void do_post_notification(idevice_t device, const char *notification)
lockdownd_client_t lockdown = NULL;
- if (lockdownd_client_new_with_handshake(device, &lockdown, "idevicebackup2") != LOCKDOWN_E_SUCCESS) {
+ if (lockdownd_client_new_with_handshake(device, &lockdown, TOOL_NAME) != LOCKDOWN_E_SUCCESS) {
return;
}
@@ -1427,11 +1429,12 @@ static void print_usage(int argc, char **argv)
printf(" cloud on|off\tenable or disable cloud use (requires iCloud account)\n");
printf("\n");
printf("OPTIONS:\n");
- printf(" -d, --debug\t\tenable communication debugging\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(" -d, --debug\t\tenable communication debugging\n");
printf(" -h, --help\t\tprints usage information\n");
+ printf(" -v, --version\t\tprints version information\n");
printf("\n");
printf("Homepage: <" PACKAGE_URL ">\n");
printf("Bug Reports: <" PACKAGE_BUGREPORT ">\n");
@@ -1501,6 +1504,10 @@ int main(int argc, char *argv[])
print_usage(argc, argv);
return 0;
}
+ else if (!strcmp(argv[i], "-v") || !strcmp(argv[i], "--version")) {
+ printf("%s %s\n", TOOL_NAME, PACKAGE_VERSION);
+ return 0;
+ }
else if (!strcmp(argv[i], "backup")) {
cmd = CMD_BACKUP;
}
@@ -1746,7 +1753,7 @@ int main(int argc, char *argv[])
}
lockdownd_client_t lockdown = NULL;
- if (LOCKDOWN_E_SUCCESS != (ldret = lockdownd_client_new_with_handshake(device, &lockdown, "idevicebackup2"))) {
+ if (LOCKDOWN_E_SUCCESS != (ldret = lockdownd_client_new_with_handshake(device, &lockdown, TOOL_NAME))) {
printf("ERROR: Could not connect to lockdownd, error code %d\n", ldret);
idevice_free(device);
return -1;
@@ -2136,7 +2143,7 @@ checkpoint:
uint8_t passcode_hint = 0;
if (device_version >= DEVICE_VERSION(13,0,0)) {
diagnostics_relay_client_t diag = NULL;
- if (diagnostics_relay_client_start_service(device, &diag, "idevicebackup2") == DIAGNOSTICS_RELAY_E_SUCCESS) {
+ if (diagnostics_relay_client_start_service(device, &diag, TOOL_NAME) == DIAGNOSTICS_RELAY_E_SUCCESS) {
plist_t dict = NULL;
plist_t keys = plist_new_array();
plist_array_append_item(keys, plist_new_string("PasswordConfigured"));
diff --git a/tools/idevicecrashreport.c b/tools/idevicecrashreport.c
index 8600ad1..0fc40c6 100644
--- a/tools/idevicecrashreport.c
+++ b/tools/idevicecrashreport.c
@@ -24,6 +24,8 @@
#include <config.h>
#endif
+#define TOOL_NAME "idevicecrashreport"
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -306,11 +308,12 @@ static void print_usage(int argc, char **argv)
printf("Move crash reports from device to a local DIRECTORY.\n");
printf("\n");
printf("OPTIONS:\n");
+ printf(" -u, --udid UDID\ttarget specific device by UDID\n");
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 UDID\n");
printf(" -h, --help\t\tprints usage information\n");
+ printf(" -v, --version\t\tprints version information\n");
printf("\n");
printf("Homepage: <" PACKAGE_URL ">\n");
printf("Bug Reports: <" PACKAGE_BUGREPORT ">\n");
@@ -351,6 +354,10 @@ int main(int argc, char* argv[])
print_usage(argc, argv);
return 0;
}
+ else if (!strcmp(argv[i], "-v") || !strcmp(argv[i], "--version")) {
+ printf("%s %s\n", TOOL_NAME, PACKAGE_VERSION);
+ return 0;
+ }
else if (!strcmp(argv[i], "-e") || !strcmp(argv[i], "--extract")) {
extract_raw_crash_reports = 1;
continue;
@@ -392,7 +399,7 @@ int main(int argc, char* argv[])
return -1;
}
- lockdownd_error = lockdownd_client_new_with_handshake(device, &lockdownd, "idevicecrashreport");
+ lockdownd_error = lockdownd_client_new_with_handshake(device, &lockdownd, TOOL_NAME);
if (lockdownd_error != LOCKDOWN_E_SUCCESS) {
fprintf(stderr, "ERROR: Could not connect to lockdownd, error code %d\n", lockdownd_error);
idevice_free(device);
diff --git a/tools/idevicedate.c b/tools/idevicedate.c
index 9c14fdf..e1fbc20 100644
--- a/tools/idevicedate.c
+++ b/tools/idevicedate.c
@@ -23,6 +23,8 @@
#include <config.h>
#endif
+#define TOOL_NAME "idevicedate"
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -56,11 +58,12 @@ static void print_usage(int argc, char **argv)
printf(" in the setup wizard screens before device activation.\n");
printf("\n");
printf("OPTIONS:\n");
- printf(" -d, --debug\t\tenable communication debugging\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(" -d, --debug\t\tenable communication debugging\n");
printf(" -h, --help\t\tprints usage information\n");
+ printf(" -v, --version\t\tprints version information\n");
printf("\n");
printf("Homepage: <" PACKAGE_URL ">\n");
printf("Bug Reports: <" PACKAGE_BUGREPORT ">\n");
@@ -129,6 +132,10 @@ int main(int argc, char *argv[])
print_usage(argc, argv);
return 0;
}
+ else if (!strcmp(argv[i], "-v") || !strcmp(argv[i], "--version")) {
+ printf("%s %s\n", TOOL_NAME, PACKAGE_VERSION);
+ return 0;
+ }
else {
print_usage(argc, argv);
return 0;
@@ -145,7 +152,7 @@ int main(int argc, char *argv[])
return -1;
}
- if (LOCKDOWN_E_SUCCESS != (ldret = lockdownd_client_new_with_handshake(device, &client, "idevicedate"))) {
+ if (LOCKDOWN_E_SUCCESS != (ldret = lockdownd_client_new_with_handshake(device, &client, TOOL_NAME))) {
fprintf(stderr, "ERROR: Could not connect to lockdownd, error code %d\n", ldret);
result = -1;
goto cleanup;
diff --git a/tools/idevicedebug.c b/tools/idevicedebug.c
index b946d2c..66e997d 100644
--- a/tools/idevicedebug.c
+++ b/tools/idevicedebug.c
@@ -23,6 +23,8 @@
#include <config.h>
#endif
+#define TOOL_NAME "idevicedebug"
+
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
@@ -193,10 +195,11 @@ static void print_usage(int argc, char **argv)
printf(" run BUNDLEID [ARGS...]\trun app with BUNDLEID and optional ARGS on device.\n");
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 UDID\n");
+ printf(" -e, --env NAME=VALUE\tset environment variable NAME to VALUE\n");
printf(" -d, --debug\t\tenable communication debugging\n");
printf(" -h, --help\t\tprints usage information\n");
+ printf(" -v, --version\t\tprints version information\n");
printf("\n");
printf("Homepage: <" PACKAGE_URL ">\n");
printf("Bug Reports: <" PACKAGE_BUGREPORT ">\n");
@@ -265,6 +268,10 @@ int main(int argc, char *argv[])
print_usage(argc, argv);
res = 0;
goto cleanup;
+ } else if (!strcmp(argv[i], "-v") || !strcmp(argv[i], "--version")) {
+ printf("%s %s\n", TOOL_NAME, PACKAGE_VERSION);
+ res = 0;
+ goto cleanup;
} else if (!strcmp(argv[i], "run")) {
cmd = CMD_RUN;
@@ -313,7 +320,7 @@ int main(int argc, char *argv[])
case CMD_RUN:
default:
/* get the path to the app and it's working directory */
- if (instproxy_client_start_service(device, &instproxy_client, "idevicerun") != INSTPROXY_E_SUCCESS) {
+ if (instproxy_client_start_service(device, &instproxy_client, TOOL_NAME) != INSTPROXY_E_SUCCESS) {
fprintf(stderr, "Could not start installation proxy service.\n");
goto cleanup;
}
@@ -334,7 +341,7 @@ int main(int argc, char *argv[])
}
/* start and connect to debugserver */
- if (debugserver_client_start_service(device, &debugserver_client, "idevicerun") != DEBUGSERVER_E_SUCCESS) {
+ if (debugserver_client_start_service(device, &debugserver_client, TOOL_NAME) != DEBUGSERVER_E_SUCCESS) {
fprintf(stderr,
"Could not start com.apple.debugserver!\n"
"Please make sure to mount the developer disk image first:\n"
diff --git a/tools/idevicedebugserverproxy.c b/tools/idevicedebugserverproxy.c
index 338a3c0..c0a0eff 100644
--- a/tools/idevicedebugserverproxy.c
+++ b/tools/idevicedebugserverproxy.c
@@ -23,6 +23,8 @@
#include <config.h>
#endif
+#define TOOL_NAME "idevicedebugserverproxy"
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -73,9 +75,10 @@ static void print_usage(int argc, char **argv)
printf("Proxy debugserver connection from device to a local socket at PORT.\n");
printf("\n");
printf("OPTIONS:\n");
- printf(" -d, --debug\t\tenable communication debugging\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(" -v, --version\t\tprints version information\n");
printf("\n");
printf("Homepage: <" PACKAGE_URL ">\n");
printf("Bug Reports: <" PACKAGE_BUGREPORT ">\n");
@@ -213,7 +216,7 @@ static void* connection_handler(void* data)
debug("%s: client_fd = %d\n", __func__, socket_info->client_fd);
- derr = debugserver_client_start_service(socket_info->device, &socket_info->debugserver_client, "idevicedebugserverproxy");
+ derr = debugserver_client_start_service(socket_info->device, &socket_info->debugserver_client, TOOL_NAME);
if (derr != DEBUGSERVER_E_SUCCESS) {
fprintf(stderr, "Could not start debugserver on device!\nPlease make sure to mount a developer disk image first.\n");
return NULL;
@@ -295,6 +298,10 @@ int main(int argc, char *argv[])
print_usage(argc, argv);
return EXIT_SUCCESS;
}
+ else if (!strcmp(argv[i], "-v") || !strcmp(argv[i], "--version")) {
+ printf("%s %s\n", TOOL_NAME, PACKAGE_VERSION);
+ return EXIT_SUCCESS;
+ }
else if (atoi(argv[i]) > 0) {
local_port = atoi(argv[i]);
continue;
diff --git a/tools/idevicediagnostics.c b/tools/idevicediagnostics.c
index 052bbed..153f9ac 100644
--- a/tools/idevicediagnostics.c
+++ b/tools/idevicediagnostics.c
@@ -23,6 +23,8 @@
#include <config.h>
#endif
+#define TOOL_NAME "idevicediagnostics"
+
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@@ -98,6 +100,11 @@ int main(int argc, char **argv)
result = EXIT_SUCCESS;
goto cleanup;
}
+ else if (!strcmp(argv[i], "-v") || !strcmp(argv[i], "--version")) {
+ printf("%s %s\n", TOOL_NAME, PACKAGE_VERSION);
+ result = EXIT_SUCCESS;
+ goto cleanup;
+ }
else if (!strcmp(argv[i], "sleep")) {
cmd = CMD_SLEEP;
}
@@ -193,7 +200,7 @@ int main(int argc, char **argv)
goto cleanup;
}
- if (LOCKDOWN_E_SUCCESS != (ret = lockdownd_client_new_with_handshake(device, &lockdown_client, "idevicediagnostics"))) {
+ if (LOCKDOWN_E_SUCCESS != (ret = lockdownd_client_new_with_handshake(device, &lockdown_client, TOOL_NAME))) {
idevice_free(device);
printf("ERROR: Could not connect to lockdownd, error code %d\n", ret);
goto cleanup;
@@ -327,9 +334,10 @@ void print_usage(int argc, char **argv)
printf(" sleep\t\t\t\tput device into sleep mode (disconnects from host)\n");
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 UDID\n");
+ printf(" -d, --debug\t\tenable communication debugging\n");
printf(" -h, --help\t\tprints usage information\n");
+ printf(" -v, --version\t\tprints version information\n");
printf("\n");
printf("Homepage: <" PACKAGE_URL ">\n");
printf("Bug Reports: <" PACKAGE_BUGREPORT ">\n");
diff --git a/tools/ideviceenterrecovery.c b/tools/ideviceenterrecovery.c
index 868ee7d..8d82929 100644
--- a/tools/ideviceenterrecovery.c
+++ b/tools/ideviceenterrecovery.c
@@ -23,6 +23,8 @@
#include <config.h>
#endif
+#define TOOL_NAME "ideviceenterrecovery"
+
#include <stdio.h>
#include <string.h>
#include <errno.h>
@@ -46,6 +48,7 @@ static void print_usage(int argc, char **argv)
printf("OPTIONS:\n");
printf(" -d, --debug\t\tenable communication debugging\n");
printf(" -h, --help\t\tprints usage information\n");
+ printf(" -v, --version\t\tprints version information\n");
printf("\n");
printf("Homepage: <" PACKAGE_URL ">\n");
printf("Bug Reports: <" PACKAGE_BUGREPORT ">\n");
@@ -73,6 +76,10 @@ int main(int argc, char *argv[])
print_usage(argc, argv);
return 0;
}
+ else if (!strcmp(argv[i], "-v") || !strcmp(argv[i], "--version")) {
+ printf("%s %s\n", TOOL_NAME, PACKAGE_VERSION);
+ return 0;
+ }
}
i--;
@@ -88,7 +95,7 @@ int main(int argc, char *argv[])
return -1;
}
- if (LOCKDOWN_E_SUCCESS != (ldret = lockdownd_client_new(device, &client, "ideviceenterrecovery"))) {
+ if (LOCKDOWN_E_SUCCESS != (ldret = lockdownd_client_new(device, &client, TOOL_NAME))) {
printf("ERROR: Could not connect to lockdownd, error code %d\n", ldret);
idevice_free(device);
return -1;
diff --git a/tools/ideviceimagemounter.c b/tools/ideviceimagemounter.c
index 3f6f42e..df43d5a 100644
--- a/tools/ideviceimagemounter.c
+++ b/tools/ideviceimagemounter.c
@@ -23,6 +23,8 @@
#include <config.h>
#endif
+#define TOOL_NAME "ideviceimagemounter"
+
#include <stdlib.h>
#define _GNU_SOURCE 1
#define __USE_GNU 1
@@ -75,6 +77,7 @@ static void print_usage(int argc, char **argv)
printf(" -x, --xml\t\tUse XML output\n");
printf(" -d, --debug\t\tenable communication debugging\n");
printf(" -h, --help\t\tprints usage information\n");
+ printf(" -v, --version\t\tprints version information\n");
printf("\n");
printf("Homepage: <" PACKAGE_URL ">\n");
printf("Bug Reports: <" PACKAGE_BUGREPORT ">\n");
@@ -83,18 +86,19 @@ static void print_usage(int argc, char **argv)
static void parse_opts(int argc, char **argv)
{
static struct option longopts[] = {
- {"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}
+ { "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'},
+ { "version", no_argument, NULL, 'v' },
+ { NULL, 0, NULL, 0 }
};
int c;
while (1) {
- c = getopt_long(argc, argv, "hu:lt:xd", longopts, NULL);
+ c = getopt_long(argc, argv, "hu:lt:xdv", longopts, NULL);
if (c == -1) {
break;
}
@@ -126,6 +130,9 @@ static void parse_opts(int argc, char **argv)
case 'd':
idevice_set_debug_level(1);
break;
+ case 'v':
+ printf("%s %s\n", TOOL_NAME, PACKAGE_VERSION);
+ exit(0);
default:
print_usage(argc, argv);
exit(2);
@@ -189,7 +196,7 @@ int main(int argc, char **argv)
return -1;
}
- if (LOCKDOWN_E_SUCCESS != (ldret = lockdownd_client_new_with_handshake(device, &lckd, "ideviceimagemounter"))) {
+ if (LOCKDOWN_E_SUCCESS != (ldret = lockdownd_client_new_with_handshake(device, &lckd, TOOL_NAME))) {
printf("ERROR: Could not connect to lockdown, error code %d.\n", ldret);
goto leave;
}
diff --git a/tools/ideviceinfo.c b/tools/ideviceinfo.c
index 0697990..9b13ab8 100644
--- a/tools/ideviceinfo.c
+++ b/tools/ideviceinfo.c
@@ -24,6 +24,8 @@
#include <config.h>
#endif
+#define TOOL_NAME "ideviceinfo"
+
#include <stdio.h>
#include <string.h>
#include <errno.h>
@@ -97,14 +99,15 @@ static void print_usage(int argc, char **argv, int is_error)
"Show information about a connected device.\n" \
"\n" \
"OPTIONS:\n" \
- " -s, --simple use a simple connection to avoid auto-pairing with the device\n" \
" -u, --udid UDID target specific device by UDID\n" \
" -n, --network connect to network device even if available via USB\n" \
+ " -s, --simple use a simple connection to avoid auto-pairing with the device\n" \
" -q, --domain NAME set domain of query to NAME. Default: None\n" \
" -k, --key NAME only query key specified by NAME. Default: All keys.\n" \
" -x, --xml output information as xml plist instead of key/value pairs\n" \
" -h, --help prints usage information\n" \
" -d, --debug enable communication debugging\n" \
+ " -v, --version prints version information\n" \
"\n"
);
fprintf(is_error ? stderr : stdout, "Known domains are:\n\n");
@@ -144,6 +147,7 @@ int main(int argc, char *argv[])
{ "key", required_argument, NULL, 'k' },
{ "simple", no_argument, NULL, 's' },
{ "xml", no_argument, NULL, 'x' },
+ { "version", no_argument, NULL, 'v' },
{ NULL, 0, NULL, 0}
};
@@ -151,7 +155,7 @@ int main(int argc, char *argv[])
signal(SIGPIPE, SIG_IGN);
#endif
- while ((c = getopt_long(argc, argv, "dhu:nq:k:sx", longopts, NULL)) != -1) {
+ while ((c = getopt_long(argc, argv, "dhu:nq:k:sxv", longopts, NULL)) != -1) {
switch (c) {
case 'd':
idevice_set_debug_level(1);
@@ -195,6 +199,9 @@ int main(int argc, char *argv[])
case 'h':
print_usage(argc, argv, 0);
return 0;
+ case 'v':
+ printf("%s %s\n", TOOL_NAME, PACKAGE_VERSION);
+ return 0;
default:
print_usage(argc, argv, 1);
return 2;
@@ -215,8 +222,8 @@ int main(int argc, char *argv[])
}
if (LOCKDOWN_E_SUCCESS != (ldret = simple ?
- lockdownd_client_new(device, &client, "ideviceinfo"):
- lockdownd_client_new_with_handshake(device, &client, "ideviceinfo"))) {
+ lockdownd_client_new(device, &client, TOOL_NAME):
+ lockdownd_client_new_with_handshake(device, &client, TOOL_NAME))) {
fprintf(stderr, "ERROR: Could not connect to lockdownd: %s (%d)\n", lockdownd_strerror(ldret), ldret);
idevice_free(device);
return -1;
diff --git a/tools/idevicename.c b/tools/idevicename.c
index af80dcc..5a34ea0 100644
--- a/tools/idevicename.c
+++ b/tools/idevicename.c
@@ -23,6 +23,8 @@
#include <config.h>
#endif
+#define TOOL_NAME "idevicename"
+
#include <stdio.h>
#include <string.h>
#include <unistd.h>
@@ -45,6 +47,7 @@ static void print_usage(void)
printf(" -d, --debug\t\tenable communication debugging\n");
printf(" -u, --udid UDID\ttarget specific device by UDID\n");
printf(" -h, --help\t\tprint usage information\n");
+ printf(" -v, --version\t\tprint version information\n");
printf("\n");
printf("Homepage: <" PACKAGE_URL ">\n");
printf("Bug Reports: <" PACKAGE_BUGREPORT ">\n");
@@ -52,22 +55,22 @@ static void print_usage(void)
int main(int argc, char** argv)
{
- int res = -1;
- char* udid = NULL;
-
int c = 0;
- int optidx = 0;
const struct option longopts[] = {
- { "udid", required_argument, NULL, 'u' },
- { "help", no_argument, NULL, 'h' },
+ { "udid", required_argument, NULL, 'u' },
+ { "debug", no_argument, NULL, 'd' },
+ { "help", no_argument, NULL, 'h' },
+ { "version", no_argument, NULL, 'v' },
{ NULL, 0, NULL, 0}
};
+ int res = -1;
+ char* udid = NULL;
#ifndef WIN32
signal(SIGPIPE, SIG_IGN);
#endif
- while ((c = getopt_long(argc, argv, "du:h", longopts, &optidx)) != -1) {
+ while ((c = getopt_long(argc, argv, "du:hv", longopts, NULL)) != -1) {
switch (c) {
case 'u':
if (!*optarg) {
@@ -84,9 +87,12 @@ int main(int argc, char** argv)
case 'd':
idevice_set_debug_level(1);
break;
+ case 'v':
+ printf("%s %s\n", TOOL_NAME, PACKAGE_VERSION);
+ return 0;
default:
print_usage();
- return -1;
+ return 2;
}
}
@@ -105,7 +111,7 @@ int main(int argc, char** argv)
}
lockdownd_client_t lockdown = NULL;
- lockdownd_error_t lerr = lockdownd_client_new_with_handshake(device, &lockdown, "idevicename");
+ lockdownd_error_t lerr = lockdownd_client_new_with_handshake(device, &lockdown, TOOL_NAME);
if (lerr != LOCKDOWN_E_SUCCESS) {
idevice_free(device);
fprintf(stderr, "ERROR: Could not connect to lockdownd, error code %d\n", lerr);
diff --git a/tools/idevicenotificationproxy.c b/tools/idevicenotificationproxy.c
index 45744bc..15b63a3 100644
--- a/tools/idevicenotificationproxy.c
+++ b/tools/idevicenotificationproxy.c
@@ -23,6 +23,8 @@
#include <config.h>
#endif
+#define TOOL_NAME "idevicenotificationproxy"
+
#include <stdio.h>
#include <string.h>
#include <errno.h>
@@ -71,9 +73,10 @@ static void print_usage(int argc, char **argv)
printf(" observe ID [...]\tobserve notification IDs in the foreground until CTRL+C or signal is received\n");
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 UDID\n");
+ printf(" -d, --debug\t\tenable communication debugging\n");
printf(" -h, --help\t\tprints usage information\n");
+ printf(" -v, --version\t\tprints version information\n");
printf("\n");
printf("Homepage: <" PACKAGE_URL ">\n");
printf("Bug Reports: <" PACKAGE_BUGREPORT ">\n");
@@ -130,6 +133,11 @@ int main(int argc, char *argv[])
result = 0;
goto cleanup;
}
+ else if (!strcmp(argv[i], "-v") || !strcmp(argv[i], "--version")) {
+ printf("%s %s\n", TOOL_NAME, PACKAGE_VERSION);
+ result = 0;
+ goto cleanup;
+ }
else if (!strcmp(argv[i], "post") || !strcmp(argv[i], "observe")) {
cmd = CMD_POST;
if (!strcmp(argv[i], "observe")) {
@@ -186,7 +194,7 @@ int main(int argc, char *argv[])
goto cleanup;
}
- if (LOCKDOWN_E_SUCCESS != (ret = lockdownd_client_new_with_handshake(device, &client, "idevicenotificationproxy"))) {
+ if (LOCKDOWN_E_SUCCESS != (ret = lockdownd_client_new_with_handshake(device, &client, TOOL_NAME))) {
fprintf(stderr, "ERROR: Could not connect to lockdownd, error code %d\n", ret);
goto cleanup;
}
diff --git a/tools/idevicepair.c b/tools/idevicepair.c
index 99c7b7c..de631a0 100644
--- a/tools/idevicepair.c
+++ b/tools/idevicepair.c
@@ -24,6 +24,8 @@
#include <config.h>
#endif
+#define TOOL_NAME "idevicepair"
+
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@@ -78,9 +80,10 @@ static void print_usage(int argc, char **argv)
printf(" list list devices paired with this host\n");
printf("\n");
printf("The following OPTIONS are accepted:\n");
- printf(" -d, --debug enable communication debugging\n");
printf(" -u, --udid UDID target specific device by UDID\n");
+ printf(" -d, --debug enable communication debugging\n");
printf(" -h, --help prints usage information\n");
+ printf(" -v, --version prints version information\n");
printf("\n");
printf("Homepage: <" PACKAGE_URL ">\n");
printf("Bug Reports: <" PACKAGE_BUGREPORT ">\n");
@@ -88,20 +91,16 @@ static void print_usage(int argc, char **argv)
static void parse_opts(int argc, char **argv)
{
+ int c = 0;
static struct option longopts[] = {
- {"help", no_argument, NULL, 'h'},
- {"udid", required_argument, NULL, 'u'},
- {"debug", no_argument, NULL, 'd'},
- {NULL, 0, NULL, 0}
+ { "help", no_argument, NULL, 'h' },
+ { "udid", required_argument, NULL, 'u' },
+ { "debug", no_argument, NULL, 'd' },
+ { "version", no_argument, NULL, 'v' },
+ { NULL, 0, NULL, 0}
};
- int c;
-
- while (1) {
- c = getopt_long(argc, argv, "hu:d", longopts, (int*)0);
- if (c == -1) {
- break;
- }
+ while ((c = getopt_long(argc, argv, "hu:dv", longopts, NULL)) != -1) {
switch (c) {
case 'h':
print_usage(argc, argv);
@@ -119,6 +118,9 @@ static void parse_opts(int argc, char **argv)
case 'd':
idevice_set_debug_level(1);
break;
+ case 'v':
+ printf("%s %s\n", TOOL_NAME, PACKAGE_VERSION);
+ exit(EXIT_SUCCESS);
default:
print_usage(argc, argv);
exit(EXIT_SUCCESS);
@@ -280,7 +282,7 @@ int main(int argc, char **argv)
case OP_VALIDATE:
lockdownd_client_free(client);
client = NULL;
- lerr = lockdownd_client_new_with_handshake(device, &client, "idevicepair");
+ lerr = lockdownd_client_new_with_handshake(device, &client, TOOL_NAME);
if (lerr == LOCKDOWN_E_SUCCESS) {
printf("SUCCESS: Validated pairing with device %s\n", udid);
} else {
diff --git a/tools/ideviceprovision.c b/tools/ideviceprovision.c
index 4b96821..8cf3de6 100644
--- a/tools/ideviceprovision.c
+++ b/tools/ideviceprovision.c
@@ -24,6 +24,8 @@
#include <config.h>
#endif
+#define TOOL_NAME "ideviceprovision"
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -69,10 +71,11 @@ static void print_usage(int argc, char **argv)
printf(" \tspecified by FILE.\n");
printf("\n");
printf("The following OPTIONS are accepted:\n");
- printf(" -d, --debug enable communication debugging\n");
printf(" -u, --udid UDID target specific device by UDID\n");
printf(" -x, --xml print XML output when using the 'dump' command\n");
+ printf(" -d, --debug enable communication debugging\n");
printf(" -h, --help prints usage information\n");
+ printf(" -v, --version prints version information\n");
printf("\n");
printf("Homepage: <" PACKAGE_URL ">\n");
printf("Bug Reports: <" PACKAGE_BUGREPORT ">\n");
@@ -376,6 +379,10 @@ int main(int argc, char *argv[])
print_usage(argc, argv);
return 0;
}
+ else if (!strcmp(argv[i], "-v") || !strcmp(argv[i], "--version")) {
+ printf("%s %s\n", TOOL_NAME, PACKAGE_VERSION);
+ return 0;
+ }
else {
print_usage(argc, argv);
return 0;
@@ -440,7 +447,7 @@ int main(int argc, char *argv[])
return -1;
}
- if (LOCKDOWN_E_SUCCESS != (ldret = lockdownd_client_new_with_handshake(device, &client, "ideviceprovision"))) {
+ if (LOCKDOWN_E_SUCCESS != (ldret = lockdownd_client_new_with_handshake(device, &client, TOOL_NAME))) {
fprintf(stderr, "ERROR: Could not connect to lockdownd, error code %d\n", ldret);
idevice_free(device);
return -1;
diff --git a/tools/idevicescreenshot.c b/tools/idevicescreenshot.c
index d91e8f4..c9dc0ef 100644
--- a/tools/idevicescreenshot.c
+++ b/tools/idevicescreenshot.c
@@ -23,6 +23,8 @@
#include <config.h>
#endif
+#define TOOL_NAME "idevicescreenshot"
+
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@@ -72,6 +74,10 @@ int main(int argc, char **argv)
print_usage(argc, argv);
return 0;
}
+ else if (!strcmp(argv[i], "-v") || !strcmp(argv[i], "--version")) {
+ printf("%s %s\n", TOOL_NAME, PACKAGE_VERSION);
+ return 0;
+ }
else if (argv[i][0] != '-' && !filename) {
filename = strdup(argv[i]);
continue;
@@ -91,7 +97,7 @@ int main(int argc, char **argv)
return -1;
}
- if (LOCKDOWN_E_SUCCESS != (ldret = lockdownd_client_new_with_handshake(device, &lckd, NULL))) {
+ if (LOCKDOWN_E_SUCCESS != (ldret = lockdownd_client_new_with_handshake(device, &lckd, TOOL_NAME))) {
idevice_free(device);
printf("ERROR: Could not connect to lockdownd, error code %d\n", ldret);
return -1;
@@ -167,9 +173,10 @@ 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");
printf("\n");
- printf(" -d, --debug\t\tenable communication debugging\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(" -v, --version\t\tprints version information\n");
printf("\n");
printf("Homepage: <" PACKAGE_URL ">\n");
printf("Bug Reports: <" PACKAGE_BUGREPORT ">\n");
diff --git a/tools/idevicesetlocation.c b/tools/idevicesetlocation.c
index 47fc7da..47f15ca 100644
--- a/tools/idevicesetlocation.c
+++ b/tools/idevicesetlocation.c
@@ -21,6 +21,9 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
+
+#define TOOL_NAME "idevicesetlocation"
+
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
@@ -52,8 +55,9 @@ static void print_usage(int argc, char **argv, int is_error)
"OPTIONS:\n" \
" -u, --udid UDID target specific device by UDID\n" \
" -n, --network connect to network device even if available via USB\n" \
- " -h, --help prints usage information\n" \
" -d, --debug enable communication debugging\n" \
+ " -h, --help prints usage information\n" \
+ " -v, --version prints version information\n" \
"\n" \
"Homepage: <" PACKAGE_URL ">\n" \
"Bug Reports: <" PACKAGE_BUGREPORT ">\n"
@@ -62,19 +66,20 @@ static void print_usage(int argc, char **argv, int is_error)
int main(int argc, char **argv)
{
+ int c = 0;
const struct option longopts[] = {
- { "help", no_argument, NULL, 'h' },
- { "udid", required_argument, NULL, 'u' },
- { "debug", no_argument, NULL, 'd' },
- { "network", no_argument, NULL, 'n' },
+ { "help", no_argument, NULL, 'h' },
+ { "udid", required_argument, NULL, 'u' },
+ { "debug", no_argument, NULL, 'd' },
+ { "network", no_argument, NULL, 'n' },
+ { "version", no_argument, NULL, 'v' },
{ NULL, 0, NULL, 0}
};
uint32_t mode = 0;
char *udid = NULL;
enum idevice_options lookup_opts = IDEVICE_LOOKUP_USBMUX | IDEVICE_LOOKUP_NETWORK;
- int c = 0;
- while ((c = getopt_long(argc, argv, "dhu:n", longopts, NULL)) != -1) {
+ while ((c = getopt_long(argc, argv, "dhu:nv", longopts, NULL)) != -1) {
switch (c) {
case 'd':
idevice_set_debug_level(1);
@@ -94,6 +99,9 @@ int main(int argc, char **argv)
case 'h':
print_usage(argc, argv, 0);
return 0;
+ case 'v':
+ printf("%s %s\n", TOOL_NAME, PACKAGE_VERSION);
+ return 0;
default:
print_usage(argc, argv, 1);
return 2;
@@ -131,7 +139,7 @@ int main(int argc, char **argv)
}
lockdownd_client_t lockdown;
- lockdownd_client_new_with_handshake(device, &lockdown, NULL);
+ lockdownd_client_new_with_handshake(device, &lockdown, TOOL_NAME);
lockdownd_service_descriptor_t svc = NULL;
if (lockdownd_start_service(lockdown, DT_SIMULATELOCATION_SERVICE, &svc) != LOCKDOWN_E_SUCCESS) {
diff --git a/tools/idevicesyslog.c b/tools/idevicesyslog.c
index 54699a0..acbcd74 100644
--- a/tools/idevicesyslog.c
+++ b/tools/idevicesyslog.c
@@ -24,6 +24,8 @@
#include "config.h"
#endif
+#define TOOL_NAME "idevicesyslog"
+
#include <stdio.h>
#include <string.h>
#include <errno.h>
@@ -408,7 +410,7 @@ static int start_logging(void)
}
lockdownd_client_t lockdown = NULL;
- lockdownd_error_t lerr = lockdownd_client_new_with_handshake(device, &lockdown, "idevicesyslog");
+ lockdownd_error_t lerr = lockdownd_client_new_with_handshake(device, &lockdown, TOOL_NAME);
if (lerr != LOCKDOWN_E_SUCCESS) {
fprintf(stderr, "ERROR: Could not connect to lockdownd: %d\n", lerr);
idevice_free(device);
@@ -528,6 +530,7 @@ static void print_usage(int argc, char **argv, int is_error)
" -x, --exit exit when device disconnects\n" \
" -h, --help prints usage information\n" \
" -d, --debug enable communication debugging\n" \
+ " -v, --version prints version information\n" \
" --no-colors disable colored output\n" \
"\n" \
"FILTER OPTIONS:\n" \
@@ -581,6 +584,7 @@ int main(int argc, char *argv[])
{ "no-kernel", no_argument, NULL, 'K' },
{ "quiet-list", no_argument, NULL, 1 },
{ "no-colors", no_argument, NULL, 2 },
+ { "version", no_argument, NULL, 'v' },
{ NULL, 0, NULL, 0}
};
@@ -591,7 +595,7 @@ int main(int argc, char *argv[])
signal(SIGPIPE, SIG_IGN);
#endif
- while ((c = getopt_long(argc, argv, "dhu:nxt:T:m:e:p:qkK", longopts, NULL)) != -1) {
+ while ((c = getopt_long(argc, argv, "dhu:nxt:T:m:e:p:qkKv", longopts, NULL)) != -1) {
switch (c) {
case 'd':
idevice_set_debug_level(1);
@@ -693,6 +697,9 @@ int main(int argc, char *argv[])
case 2:
no_colors = 1;
break;
+ case 'v':
+ printf("%s %s\n", TOOL_NAME, PACKAGE_VERSION);
+ return 0;
default:
print_usage(argc, argv, 1);
return 2;