summaryrefslogtreecommitdiffstats
path: root/tools/idevicescreenshot.c
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2020-06-05 18:42:20 +0200
committerGravatar Nikias Bassen2020-06-05 18:42:20 +0200
commit3aa4e243faa8198550cb2851cb6f0b9cbb293812 (patch)
tree4ea94424d60f1f2e7852f148a41eaeb7e92657a5 /tools/idevicescreenshot.c
parenta077067bf9458612d54157e3c875d065e3678a54 (diff)
downloadlibimobiledevice-3aa4e243faa8198550cb2851cb6f0b9cbb293812.tar.gz
libimobiledevice-3aa4e243faa8198550cb2851cb6f0b9cbb293812.tar.bz2
tools: Add --version command line switch
Diffstat (limited to 'tools/idevicescreenshot.c')
-rw-r--r--tools/idevicescreenshot.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/tools/idevicescreenshot.c b/tools/idevicescreenshot.c
index d91e8f4..c9dc0ef 100644
--- a/tools/idevicescreenshot.c
+++ b/tools/idevicescreenshot.c
@@ -23,6 +23,8 @@
23#include <config.h> 23#include <config.h>
24#endif 24#endif
25 25
26#define TOOL_NAME "idevicescreenshot"
27
26#include <stdio.h> 28#include <stdio.h>
27#include <string.h> 29#include <string.h>
28#include <stdlib.h> 30#include <stdlib.h>
@@ -72,6 +74,10 @@ int main(int argc, char **argv)
72 print_usage(argc, argv); 74 print_usage(argc, argv);
73 return 0; 75 return 0;
74 } 76 }
77 else if (!strcmp(argv[i], "-v") || !strcmp(argv[i], "--version")) {
78 printf("%s %s\n", TOOL_NAME, PACKAGE_VERSION);
79 return 0;
80 }
75 else if (argv[i][0] != '-' && !filename) { 81 else if (argv[i][0] != '-' && !filename) {
76 filename = strdup(argv[i]); 82 filename = strdup(argv[i]);
77 continue; 83 continue;
@@ -91,7 +97,7 @@ int main(int argc, char **argv)
91 return -1; 97 return -1;
92 } 98 }
93 99
94 if (LOCKDOWN_E_SUCCESS != (ldret = lockdownd_client_new_with_handshake(device, &lckd, NULL))) { 100 if (LOCKDOWN_E_SUCCESS != (ldret = lockdownd_client_new_with_handshake(device, &lckd, TOOL_NAME))) {
95 idevice_free(device); 101 idevice_free(device);
96 printf("ERROR: Could not connect to lockdownd, error code %d\n", ldret); 102 printf("ERROR: Could not connect to lockdownd, error code %d\n", ldret);
97 return -1; 103 return -1;
@@ -167,9 +173,10 @@ void print_usage(int argc, char **argv)
167 printf("NOTE: A mounted developer disk image is required on the device, otherwise\n"); 173 printf("NOTE: A mounted developer disk image is required on the device, otherwise\n");
168 printf("the screenshotr service is not available.\n"); 174 printf("the screenshotr service is not available.\n");
169 printf("\n"); 175 printf("\n");
170 printf(" -d, --debug\t\tenable communication debugging\n");
171 printf(" -u, --udid UDID\ttarget specific device by UDID\n"); 176 printf(" -u, --udid UDID\ttarget specific device by UDID\n");
177 printf(" -d, --debug\t\tenable communication debugging\n");
172 printf(" -h, --help\t\tprints usage information\n"); 178 printf(" -h, --help\t\tprints usage information\n");
179 printf(" -v, --version\t\tprints version information\n");
173 printf("\n"); 180 printf("\n");
174 printf("Homepage: <" PACKAGE_URL ">\n"); 181 printf("Homepage: <" PACKAGE_URL ">\n");
175 printf("Bug Reports: <" PACKAGE_BUGREPORT ">\n"); 182 printf("Bug Reports: <" PACKAGE_BUGREPORT ">\n");