diff options
author | 2022-04-30 13:31:20 +0200 | |
---|---|---|
committer | 2022-04-30 13:31:20 +0200 | |
commit | 6cb13f9e6d3939930aecf91d8e23d1896a3b92e5 (patch) | |
tree | 371e4676ac914d9eef6bb4cfc0b5b6dc6f27da4f /tools/ideviceinfo.c | |
parent | 3b5cad28fabb236e05b8fff82fab5098127aa2bb (diff) | |
download | libimobiledevice-6cb13f9e6d3939930aecf91d8e23d1896a3b92e5.tar.gz libimobiledevice-6cb13f9e6d3939930aecf91d8e23d1896a3b92e5.tar.bz2 |
tools: Use getopt for option parsing in all tools
Diffstat (limited to 'tools/ideviceinfo.c')
-rw-r--r-- | tools/ideviceinfo.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/tools/ideviceinfo.c b/tools/ideviceinfo.c index f80b678..ead3fa6 100644 --- a/tools/ideviceinfo.c +++ b/tools/ideviceinfo.c | |||
@@ -93,23 +93,22 @@ static int is_domain_known(const char *domain) | |||
93 | static void print_usage(int argc, char **argv, int is_error) | 93 | static void print_usage(int argc, char **argv, int is_error) |
94 | { | 94 | { |
95 | int i = 0; | 95 | int i = 0; |
96 | char *name = NULL; | 96 | char *name = strrchr(argv[0], '/'); |
97 | name = strrchr(argv[0], '/'); | ||
98 | fprintf(is_error ? stderr : stdout, "Usage: %s [OPTIONS]\n", (name ? name + 1: argv[0])); | 97 | fprintf(is_error ? stderr : stdout, "Usage: %s [OPTIONS]\n", (name ? name + 1: argv[0])); |
99 | fprintf(is_error ? stderr : stdout, | 98 | fprintf(is_error ? stderr : stdout, |
100 | "\n" \ | 99 | "\n" |
101 | "Show information about a connected device.\n" \ | 100 | "Show information about a connected device.\n" |
102 | "\n" \ | 101 | "\n" |
103 | "OPTIONS:\n" \ | 102 | "OPTIONS:\n" |
104 | " -u, --udid UDID target specific device by UDID\n" \ | 103 | " -u, --udid UDID target specific device by UDID\n" |
105 | " -n, --network connect to network device\n" \ | 104 | " -n, --network connect to network device\n" |
106 | " -s, --simple use a simple connection to avoid auto-pairing with the device\n" \ | 105 | " -s, --simple use simple connection to avoid auto-pairing with device\n" |
107 | " -q, --domain NAME set domain of query to NAME. Default: None\n" \ | 106 | " -q, --domain NAME set domain of query to NAME. Default: None\n" \ |
108 | " -k, --key NAME only query key specified by NAME. Default: All keys.\n" \ | 107 | " -k, --key NAME only query key specified by NAME. Default: All keys.\n" \ |
109 | " -x, --xml output information as xml plist instead of key/value pairs\n" \ | 108 | " -x, --xml output information in XML property list format\n" \ |
110 | " -h, --help prints usage information\n" \ | 109 | " -h, --help prints usage information\n" \ |
111 | " -d, --debug enable communication debugging\n" \ | 110 | " -d, --debug enable communication debugging\n" \ |
112 | " -v, --version prints version information\n" \ | 111 | " -v, --version prints version information\n" \ |
113 | "\n" | 112 | "\n" |
114 | ); | 113 | ); |
115 | fprintf(is_error ? stderr : stdout, "Known domains are:\n\n"); | 114 | fprintf(is_error ? stderr : stdout, "Known domains are:\n\n"); |