iscsi-swp: handle setting of debug_level correctly
According to the man page and help info, --debug=integer can specify the debug_level, while it would report following error: iscsi-swp --debug=1 iscsi-swp: option '--debug' doesn't allow an argument
This commit is contained in:
committed by
Bart Van Assche
parent
8592dc5883
commit
b087a09a0b
@@ -75,14 +75,14 @@ int main(int argc, char *argv[])
|
|||||||
static struct option long_options[] = {
|
static struct option long_options[] = {
|
||||||
{"help", no_argument, NULL, 'h'},
|
{"help", no_argument, NULL, 'h'},
|
||||||
{"usage", no_argument, NULL, 'u'},
|
{"usage", no_argument, NULL, 'u'},
|
||||||
{"debug", no_argument, NULL, 'd'},
|
{"debug", required_argument, NULL, 'd'},
|
||||||
{"initiator-name", required_argument, NULL, 'i'},
|
{"initiator-name", required_argument, NULL, 'i'},
|
||||||
{"swp", required_argument, NULL, 's'},
|
{"swp", required_argument, NULL, 's'},
|
||||||
{0, 0, 0, 0}
|
{0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
int option_index;
|
int option_index;
|
||||||
|
|
||||||
while ((c = getopt_long(argc, argv, "h?udi:s:", long_options,
|
while ((c = getopt_long(argc, argv, "h?ud:i:s:", long_options,
|
||||||
&option_index)) != -1) {
|
&option_index)) != -1) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'h':
|
case 'h':
|
||||||
@@ -93,7 +93,7 @@ int main(int argc, char *argv[])
|
|||||||
show_usage = 1;
|
show_usage = 1;
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
debug = 1;
|
debug = atoi(optarg);
|
||||||
break;
|
break;
|
||||||
case 'i':
|
case 'i':
|
||||||
initiator = optarg;
|
initiator = optarg;
|
||||||
|
|||||||
Reference in New Issue
Block a user