mirror of
https://github.com/corda/corda.git
synced 2025-01-04 04:04:27 +00:00
fix handling of no-argument options in bootimage.cpp
This commit is contained in:
parent
f6299fdfe6
commit
ba6ca031bb
@ -1769,8 +1769,10 @@ bool ArgParser::parse(int ac, const char** av) {
|
||||
fprintf(stderr, "expected -parameter\n");
|
||||
return false;
|
||||
}
|
||||
bool found = false;
|
||||
for(Arg* arg = first; arg; arg = arg->next) {
|
||||
if(strcmp(arg->name, &av[i][1]) == 0) {
|
||||
found = true;
|
||||
if (arg->desc == 0) {
|
||||
arg->value = "true";
|
||||
} else {
|
||||
@ -1778,7 +1780,7 @@ bool ArgParser::parse(int ac, const char** av) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!state) {
|
||||
if (not found) {
|
||||
fprintf(stderr, "unrecognized parameter %s\n", av[i]);
|
||||
return false;
|
||||
}
|
||||
@ -1806,8 +1808,10 @@ void ArgParser::printUsage(const char* exe) {
|
||||
const char* lineEnd = arg->next ? " \\" : "";
|
||||
if(arg->required) {
|
||||
fprintf(stderr, " -%s\t%s%s\n", arg->name, arg->desc, lineEnd);
|
||||
} else {
|
||||
} else if (arg->desc) {
|
||||
fprintf(stderr, " [-%s\t%s]%s\n", arg->name, arg->desc, lineEnd);
|
||||
} else {
|
||||
fprintf(stderr, " [-%s]%s\n", arg->name, lineEnd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user