make style

This commit is contained in:
merlokk 2021-07-06 12:16:19 +03:00
commit 20696fb44a
10 changed files with 260 additions and 186 deletions

View file

@ -304,13 +304,13 @@ int CLIGetOptionList(struct arg_str *argstr, const CLIParserOption *option_array
int res = CLIParamStrToBuf(argstr, (uint8_t *)data, sizeof(data), &datalen);
if (res)
return res;
// no data to check - we do not touch *value, just return
if (datalen == 0)
return 0;
str_lower(data);
int val = -1;
int cntr = 0;
for (int i = 0; i < CLI_MAX_OPTLIST_LEN; i++) {
@ -328,7 +328,7 @@ int CLIGetOptionList(struct arg_str *argstr, const CLIParserOption *option_array
cntr++;
}
}
// check partial match
if (cntr == 0) {
PrintAndLogEx(ERR, "Parameter error: No similar option to `%s`. Valid options: %s\n", argstr->sval[0], argstr->hdr.datatype);
@ -338,14 +338,14 @@ int CLIGetOptionList(struct arg_str *argstr, const CLIParserOption *option_array
PrintAndLogEx(ERR, "Parameter error: Several options fit to `%s`. Valid options: %s\n", argstr->sval[0], argstr->hdr.datatype);
return 21;
}
*value = val;
return 0;
*value = val;
return 0;
}
const char *CLIGetOptionListStr(const CLIParserOption *option_array, int value) {
static const char *errmsg = "n/a";
for (int i = 0; i < CLI_MAX_OPTLIST_LEN; i++) {
if (option_array[i].text == NULL)
break;