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