Added -V, --version option

This commit is contained in:
Shazron Abdullah 2013-10-22 14:10:52 -07:00
parent 1fe3ce5244
commit 2c99d25d53

View File

@ -15,6 +15,7 @@
#include <netinet/tcp.h>
#include "MobileDevice.h"
#define APP_VERSION "1.0.2"
#define PREP_CMDS_PATH "/tmp/fruitstrap-lldb-prep-cmds-"
#define LLDB_SHELL "python -u -c \"import time; time.sleep(0.5); print 'run'; time.sleep(2000000)\" | lldb -s " PREP_CMDS_PATH
@ -746,10 +747,15 @@ void usage(const char* app) {
" -x, --gdbexec <file> GDB commands script file\n"
" -n, --nostart do not start the app when debugging\n"
" -v, --verbose enable verbose output\n"
" -m, --noinstall directly start debugging without app install (-d not required) \n",
" -m, --noinstall directly start debugging without app install (-d not required) \n"
" -V, --version print the executable version \n",
app);
}
void show_version() {
printf("%s\n", APP_VERSION);
}
int main(int argc, char *argv[]) {
static struct option longopts[] = {
{ "debug", no_argument, NULL, 'd' },
@ -762,12 +768,13 @@ int main(int argc, char *argv[]) {
{ "unbuffered", no_argument, NULL, 'u' },
{ "nostart", no_argument, NULL, 'n' },
{ "detect", no_argument, NULL, 'c' },
{ "version", no_argument, NULL, 'V' },
{ "noinstall", no_argument, NULL, 'm' },
{ NULL, 0, NULL, 0 },
};
char ch;
while ((ch = getopt_long(argc, argv, "mcdvuni:b:a:t:g:x:", longopts, NULL)) != -1)
while ((ch = getopt_long(argc, argv, "Vmcdvuni:b:a:t:g:x:", longopts, NULL)) != -1)
{
switch (ch) {
case 'm':
@ -801,6 +808,9 @@ int main(int argc, char *argv[]) {
case 'c':
detect_only = true;
break;
case 'V':
show_version();
return 1;
default:
usage(argv[0]);
return 1;