summaryrefslogtreecommitdiffstats
path: root/tools/ideviceinfo.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/ideviceinfo.c
parenta077067bf9458612d54157e3c875d065e3678a54 (diff)
downloadlibimobiledevice-3aa4e243faa8198550cb2851cb6f0b9cbb293812.tar.gz
libimobiledevice-3aa4e243faa8198550cb2851cb6f0b9cbb293812.tar.bz2
tools: Add --version command line switch
Diffstat (limited to 'tools/ideviceinfo.c')
-rw-r--r--tools/ideviceinfo.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/tools/ideviceinfo.c b/tools/ideviceinfo.c
index 0697990..9b13ab8 100644
--- a/tools/ideviceinfo.c
+++ b/tools/ideviceinfo.c
@@ -24,6 +24,8 @@
#include <config.h>
#endif
+#define TOOL_NAME "ideviceinfo"
+
#include <stdio.h>
#include <string.h>
#include <errno.h>
@@ -97,14 +99,15 @@ static void print_usage(int argc, char **argv, int is_error)
"Show information about a connected device.\n" \
"\n" \
"OPTIONS:\n" \
- " -s, --simple use a simple connection to avoid auto-pairing with the device\n" \
" -u, --udid UDID target specific device by UDID\n" \
" -n, --network connect to network device even if available via USB\n" \
+ " -s, --simple use a simple connection to avoid auto-pairing with the device\n" \
" -q, --domain NAME set domain of query to NAME. Default: None\n" \
" -k, --key NAME only query key specified by NAME. Default: All keys.\n" \
" -x, --xml output information as xml plist instead of key/value pairs\n" \
" -h, --help prints usage information\n" \
" -d, --debug enable communication debugging\n" \
+ " -v, --version prints version information\n" \
"\n"
);
fprintf(is_error ? stderr : stdout, "Known domains are:\n\n");
@@ -144,6 +147,7 @@ int main(int argc, char *argv[])
{ "key", required_argument, NULL, 'k' },
{ "simple", no_argument, NULL, 's' },
{ "xml", no_argument, NULL, 'x' },
+ { "version", no_argument, NULL, 'v' },
{ NULL, 0, NULL, 0}
};
@@ -151,7 +155,7 @@ int main(int argc, char *argv[])
signal(SIGPIPE, SIG_IGN);
#endif
- while ((c = getopt_long(argc, argv, "dhu:nq:k:sx", longopts, NULL)) != -1) {
+ while ((c = getopt_long(argc, argv, "dhu:nq:k:sxv", longopts, NULL)) != -1) {
switch (c) {
case 'd':
idevice_set_debug_level(1);
@@ -195,6 +199,9 @@ int main(int argc, char *argv[])
case 'h':
print_usage(argc, argv, 0);
return 0;
+ case 'v':
+ printf("%s %s\n", TOOL_NAME, PACKAGE_VERSION);
+ return 0;
default:
print_usage(argc, argv, 1);
return 2;
@@ -215,8 +222,8 @@ int main(int argc, char *argv[])
}
if (LOCKDOWN_E_SUCCESS != (ldret = simple ?
- lockdownd_client_new(device, &client, "ideviceinfo"):
- lockdownd_client_new_with_handshake(device, &client, "ideviceinfo"))) {
+ lockdownd_client_new(device, &client, TOOL_NAME):
+ lockdownd_client_new_with_handshake(device, &client, TOOL_NAME))) {
fprintf(stderr, "ERROR: Could not connect to lockdownd: %s (%d)\n", lockdownd_strerror(ldret), ldret);
idevice_free(device);
return -1;