From 6cb13f9e6d3939930aecf91d8e23d1896a3b92e5 Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Sat, 30 Apr 2022 13:31:20 +0200 Subject: tools: Use getopt for option parsing in all tools --- tools/ideviceinfo.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'tools/ideviceinfo.c') 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) static void print_usage(int argc, char **argv, int is_error) { int i = 0; - char *name = NULL; - name = strrchr(argv[0], '/'); + char *name = strrchr(argv[0], '/'); fprintf(is_error ? stderr : stdout, "Usage: %s [OPTIONS]\n", (name ? name + 1: argv[0])); fprintf(is_error ? stderr : stdout, - "\n" \ - "Show information about a connected device.\n" \ - "\n" \ - "OPTIONS:\n" \ - " -u, --udid UDID target specific device by UDID\n" \ - " -n, --network connect to network device\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" + "Show information about a connected device.\n" + "\n" + "OPTIONS:\n" + " -u, --udid UDID target specific device by UDID\n" + " -n, --network connect to network device\n" + " -s, --simple use simple connection to avoid auto-pairing with 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 in XML property list format\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"); -- cgit v1.1-32-gdbae