From 81cf29be7002c3a0f065e1f3e761654e35edc193 Mon Sep 17 00:00:00 2001 From: Dominic Clifton Date: Sat, 2 Aug 2014 10:05:38 +0100 Subject: [PATCH] Avoid error message appearing incorrectly after showing cli commands. --- src/main/io/serial_cli.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/io/serial_cli.c b/src/main/io/serial_cli.c index d5ad14577b..9e8c19a1b5 100644 --- a/src/main/io/serial_cli.c +++ b/src/main/io/serial_cli.c @@ -973,6 +973,7 @@ static void cliGet(char *cmdline) { uint32_t i; const clivalue_t *val; + int matchedCommands = 0; for (i = 0; i < VALUE_COUNT; i++) { if (strstr(valueTable[i].name, cmdline)) { @@ -980,10 +981,16 @@ static void cliGet(char *cmdline) printf("%s = ", valueTable[i].name); cliPrintVar(val, 0); printf("\r\n"); + + matchedCommands++; } } - // If we get down here, then the variable was not found + + if (matchedCommands) { + return; + } + cliPrint("ERR: Unknown variable name\r\n"); }