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/idevicescreenshot.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'tools/idevicescreenshot.c') 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 #endif +#define TOOL_NAME "idevicescreenshot" + #include #include #include @@ -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"); -- cgit v1.1-32-gdbae