From df5f12e84365d3c65df85ffe6b564e5d78deb64b Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Mon, 10 Mar 2014 16:13:54 +0100 Subject: idevicename: refine usage information and add -h|--help command line switch --- tools/idevicename.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'tools/idevicename.c') diff --git a/tools/idevicename.c b/tools/idevicename.c index 8b45626..cd8faff 100644 --- a/tools/idevicename.c +++ b/tools/idevicename.c @@ -31,7 +31,10 @@ static void print_usage() { printf("\nUsage: idevicename [OPTIONS] [NAME]\n"); + printf("Display the device name or set it to NAME if specified.\n"); + printf("\n"); printf(" --udid|-u UDID use UDID to target a specific device\n"); + printf(" --help|-h print usage information\n"); printf("\n"); } @@ -44,16 +47,21 @@ int main(int argc, char** argv) int optidx = 0; const struct option longopts[] = { { "udid", required_argument, NULL, 'u' }, + { "help", no_argument, NULL, 'h' }, { NULL, 0, NULL, 0} }; - while ((c = getopt_long(argc, argv, "u:", longopts, &optidx)) != -1) { + while ((c = getopt_long(argc, argv, "u:h", longopts, &optidx)) != -1) { switch (c) { case 'u': udid = strdup(optarg); break; + case 'h': + print_usage(); + return 0; default: - break; + print_usage(); + return -1; } } -- cgit v1.1-32-gdbae