From 7d0ba9249319d9e40e061c40810954ed6448b236 Mon Sep 17 00:00:00 2001 From: Shazron Abdullah Date: Fri, 10 May 2013 16:44:54 -0700 Subject: [PATCH] Added -V/--version flag to output the app version. --- ios-deploy.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/ios-deploy.c b/ios-deploy.c index 6693f51..840505e 100644 --- a/ios-deploy.c +++ b/ios-deploy.c @@ -9,6 +9,7 @@ #include #include "MobileDevice.h" +#define APP_VERSION "1.0" #define FDVENDOR_PATH "/tmp/fruitstrap-remote-debugserver" #define PREP_CMDS_PATH "/tmp/fruitstrap-gdb-prep-cmds" #define GDB_SHELL "/Developer/Platforms/iPhoneOS.platform/Developer/usr/libexec/gdb/gdb-arm-apple-darwin --arch armv7 -q -x " PREP_CMDS_PATH @@ -496,7 +497,11 @@ void timeout_callback(CFRunLoopTimerRef timer, void *info) { } void usage(const char* app) { - printf("usage: %s [-d/--debug] [-i/--id device_id] -b/--bundle bundle.app [-a/--args arguments] [-t/--timeout timeout(seconds)]\n", app); + printf("usage: %s [-V/--version] [-v/--verbose] [-d/--debug] [-i/--id device_id] -b/--bundle bundle.app [-a/--args arguments] [-t/--timeout timeout(seconds)]\n", app); +} + +void version() { + printf("%s\n", APP_VERSION); } int main(int argc, char *argv[]) { @@ -507,11 +512,12 @@ int main(int argc, char *argv[]) { { "args", required_argument, NULL, 'a' }, { "verbose", no_argument, NULL, 'v' }, { "timeout", required_argument, NULL, 't' }, + { "version", no_argument, NULL, 'V' }, { NULL, 0, NULL, 0 }, }; char ch; - while ((ch = getopt_long(argc, argv, "dvi:b:a:t:", longopts, NULL)) != -1) + while ((ch = getopt_long(argc, argv, "Vdvi:b:a:t:", longopts, NULL)) != -1) { switch (ch) { case 'd': @@ -529,6 +535,9 @@ int main(int argc, char *argv[]) { case 'v': verbose = 1; break; + case 'V': + version(); + return 1; case 't': timeout = atoi(optarg); break;