1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-14 20:10:18 +03:00

Simplify CLI case-insensitive by using new strcasestr() (#5449)

Remove string lowercase function from cli.c and use the new strcasestr() added to string_light.c
This commit is contained in:
etracer65 2018-03-15 14:41:00 -04:00 committed by Michael Keller
parent 6056ee1740
commit 0e051bebb2
2 changed files with 3 additions and 11 deletions

View file

@ -208,16 +208,6 @@ 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) {
@ -2838,7 +2828,7 @@ STATIC_UNIT_TESTED void cliGet(char *cmdline)
int matchedCommands = 0;
for (uint32_t i = 0; i < valueTableEntryCount; i++) {
if (strstr(valueTable[i].name, cliStringToLowercase(cmdline))) {
if (strcasestr(valueTable[i].name, cmdline)) {
val = &valueTable[i];
cliPrintf("%s = ", valueTable[i].name);
cliPrintVar(val, 0);