diff options
author | Nikias Bassen | 2014-03-10 16:13:54 +0100 |
---|---|---|
committer | Nikias Bassen | 2014-03-10 16:13:54 +0100 |
commit | df5f12e84365d3c65df85ffe6b564e5d78deb64b (patch) | |
tree | b0f249018fef19d708929f9fdd6a0b2c73a78df1 /tools/idevicename.c | |
parent | 3d161e0f0c98392550c75a9c5722b447eef4efa2 (diff) | |
download | libimobiledevice-df5f12e84365d3c65df85ffe6b564e5d78deb64b.tar.gz libimobiledevice-df5f12e84365d3c65df85ffe6b564e5d78deb64b.tar.bz2 |
idevicename: refine usage information and add -h|--help command line switch
Diffstat (limited to 'tools/idevicename.c')
-rw-r--r-- | tools/idevicename.c | 12 |
1 files changed, 10 insertions, 2 deletions
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; } } |