From f97df6827e968a827e05e5be60fa80194d308e60 Mon Sep 17 00:00:00 2001 From: etracer65 Date: Thu, 8 Mar 2018 12:50:31 -0500 Subject: [PATCH] Change CLI "get" to be case-insensitive (#5382) Matches the behavior of the "set" command. --- src/main/interface/cli.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/interface/cli.c b/src/main/interface/cli.c index a4e8efe591..0a189dfb37 100644 --- a/src/main/interface/cli.c +++ b/src/main/interface/cli.c @@ -208,6 +208,16 @@ static const char * const *sensorHardwareNames[] = { }; #endif // USE_SENSOR_NAMES +static char *cliStringToLowercase(char *str) +{ + char *s = str; + while (*s) { + *s = tolower((unsigned char)*s); + s++; + } + return str; +} + static void cliPrint(const char *str) { while (*str) { @@ -2828,7 +2838,7 @@ STATIC_UNIT_TESTED void cliGet(char *cmdline) int matchedCommands = 0; for (uint32_t i = 0; i < valueTableEntryCount; i++) { - if (strstr(valueTable[i].name, cmdline)) { + if (strstr(valueTable[i].name, cliStringToLowercase(cmdline))) { val = &valueTable[i]; cliPrintf("%s = ", valueTable[i].name); cliPrintVar(val, 0);