diff options
Diffstat (limited to 'tools/ideviceimagemounter.c')
| -rw-r--r-- | tools/ideviceimagemounter.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/tools/ideviceimagemounter.c b/tools/ideviceimagemounter.c index 3f6f42e..df43d5a 100644 --- a/tools/ideviceimagemounter.c +++ b/tools/ideviceimagemounter.c | |||
| @@ -23,6 +23,8 @@ | |||
| 23 | #include <config.h> | 23 | #include <config.h> |
| 24 | #endif | 24 | #endif |
| 25 | 25 | ||
| 26 | #define TOOL_NAME "ideviceimagemounter" | ||
| 27 | |||
| 26 | #include <stdlib.h> | 28 | #include <stdlib.h> |
| 27 | #define _GNU_SOURCE 1 | 29 | #define _GNU_SOURCE 1 |
| 28 | #define __USE_GNU 1 | 30 | #define __USE_GNU 1 |
| @@ -75,6 +77,7 @@ static void print_usage(int argc, char **argv) | |||
| 75 | printf(" -x, --xml\t\tUse XML output\n"); | 77 | printf(" -x, --xml\t\tUse XML output\n"); |
| 76 | printf(" -d, --debug\t\tenable communication debugging\n"); | 78 | printf(" -d, --debug\t\tenable communication debugging\n"); |
| 77 | printf(" -h, --help\t\tprints usage information\n"); | 79 | printf(" -h, --help\t\tprints usage information\n"); |
| 80 | printf(" -v, --version\t\tprints version information\n"); | ||
| 78 | printf("\n"); | 81 | printf("\n"); |
| 79 | printf("Homepage: <" PACKAGE_URL ">\n"); | 82 | printf("Homepage: <" PACKAGE_URL ">\n"); |
| 80 | printf("Bug Reports: <" PACKAGE_BUGREPORT ">\n"); | 83 | printf("Bug Reports: <" PACKAGE_BUGREPORT ">\n"); |
| @@ -83,18 +86,19 @@ static void print_usage(int argc, char **argv) | |||
| 83 | static void parse_opts(int argc, char **argv) | 86 | static void parse_opts(int argc, char **argv) |
| 84 | { | 87 | { |
| 85 | static struct option longopts[] = { | 88 | static struct option longopts[] = { |
| 86 | {"help", no_argument, NULL, 'h'}, | 89 | { "help", no_argument, NULL, 'h'}, |
| 87 | {"udid", required_argument, NULL, 'u'}, | 90 | { "udid", required_argument, NULL, 'u'}, |
| 88 | {"list", no_argument, NULL, 'l'}, | 91 | { "list", no_argument, NULL, 'l'}, |
| 89 | {"imagetype", required_argument, NULL, 't'}, | 92 | { "imagetype", required_argument, NULL, 't'}, |
| 90 | {"xml", no_argument, NULL, 'x'}, | 93 | { "xml", no_argument, NULL, 'x'}, |
| 91 | {"debug", no_argument, NULL, 'd'}, | 94 | { "debug", no_argument, NULL, 'd'}, |
| 92 | {NULL, 0, NULL, 0} | 95 | { "version", no_argument, NULL, 'v' }, |
| 96 | { NULL, 0, NULL, 0 } | ||
| 93 | }; | 97 | }; |
| 94 | int c; | 98 | int c; |
| 95 | 99 | ||
| 96 | while (1) { | 100 | while (1) { |
| 97 | c = getopt_long(argc, argv, "hu:lt:xd", longopts, NULL); | 101 | c = getopt_long(argc, argv, "hu:lt:xdv", longopts, NULL); |
| 98 | if (c == -1) { | 102 | if (c == -1) { |
| 99 | break; | 103 | break; |
| 100 | } | 104 | } |
| @@ -126,6 +130,9 @@ static void parse_opts(int argc, char **argv) | |||
| 126 | case 'd': | 130 | case 'd': |
| 127 | idevice_set_debug_level(1); | 131 | idevice_set_debug_level(1); |
| 128 | break; | 132 | break; |
| 133 | case 'v': | ||
| 134 | printf("%s %s\n", TOOL_NAME, PACKAGE_VERSION); | ||
| 135 | exit(0); | ||
| 129 | default: | 136 | default: |
| 130 | print_usage(argc, argv); | 137 | print_usage(argc, argv); |
| 131 | exit(2); | 138 | exit(2); |
| @@ -189,7 +196,7 @@ int main(int argc, char **argv) | |||
| 189 | return -1; | 196 | return -1; |
| 190 | } | 197 | } |
| 191 | 198 | ||
| 192 | if (LOCKDOWN_E_SUCCESS != (ldret = lockdownd_client_new_with_handshake(device, &lckd, "ideviceimagemounter"))) { | 199 | if (LOCKDOWN_E_SUCCESS != (ldret = lockdownd_client_new_with_handshake(device, &lckd, TOOL_NAME))) { |
| 193 | printf("ERROR: Could not connect to lockdown, error code %d.\n", ldret); | 200 | printf("ERROR: Could not connect to lockdown, error code %d.\n", ldret); |
| 194 | goto leave; | 201 | goto leave; |
| 195 | } | 202 | } |
