From 3aa4e243faa8198550cb2851cb6f0b9cbb293812 Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Fri, 5 Jun 2020 18:42:20 +0200 Subject: tools: Add --version command line switch --- tools/idevicediagnostics.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'tools/idevicediagnostics.c') 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 #endif +#define TOOL_NAME "idevicediagnostics" + #include #include #include @@ -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"); -- cgit v1.1-32-gdbae