iscsi-perf: Add -h/--help
Add -h/--help to show usage without "Unrecognized option". Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
This commit is contained in:
committed by
Bart Van Assche
parent
22f7b26567
commit
2b9d5bdbad
@@ -268,6 +268,7 @@ int main(int argc, char *argv[])
|
|||||||
{"random-blocks", no_argument, NULL, 'R'},
|
{"random-blocks", no_argument, NULL, 'R'},
|
||||||
{"logging", no_argument, NULL, 'l'},
|
{"logging", no_argument, NULL, 'l'},
|
||||||
{"ignore-errors", no_argument, NULL, 'n'},
|
{"ignore-errors", no_argument, NULL, 'n'},
|
||||||
|
{"help", no_argument, NULL, 'h'},
|
||||||
{0, 0, 0, 0}
|
{0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
int option_index;
|
int option_index;
|
||||||
@@ -279,7 +280,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
printf("iscsi-perf version %s - (c) 2014-2015 by Peter Lieven <pl@ĸamp.de>\n\n", PERF_VERSION);
|
printf("iscsi-perf version %s - (c) 2014-2015 by Peter Lieven <pl@ĸamp.de>\n\n", PERF_VERSION);
|
||||||
|
|
||||||
while ((c = getopt_long(argc, argv, "i:m:b:t:lnrRx:", long_options,
|
while ((c = getopt_long(argc, argv, "i:m:b:t:lnrRx:h", long_options,
|
||||||
&option_index)) != -1) {
|
&option_index)) != -1) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'i':
|
case 'i':
|
||||||
@@ -309,6 +310,9 @@ int main(int argc, char *argv[])
|
|||||||
case 'x':
|
case 'x':
|
||||||
client.max_reconnects = atoi(optarg);
|
client.max_reconnects = atoi(optarg);
|
||||||
break;
|
break;
|
||||||
|
case 'h':
|
||||||
|
usage();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "Unrecognized option '%c'\n\n", c);
|
fprintf(stderr, "Unrecognized option '%c'\n\n", c);
|
||||||
usage();
|
usage();
|
||||||
|
|||||||
Reference in New Issue
Block a user