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