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