Added # to versionstring and strip comments
Prepended the version string with a # to avoid the CLI from interpreting the version string as a command when pasting a dump file back (restore in CLI). Strip comments starting with `# comment` from lines. This is to allow adding comments to CLI dumped backup files. For this i have an automated addition of comments and/or manual comments by the user in mind.
This commit is contained in:
parent
b739a57ea2
commit
1df9097e32
|
@ -1644,7 +1644,7 @@ static void cliVersion(char *cmdline)
|
|||
{
|
||||
UNUSED(cmdline);
|
||||
|
||||
printf("Cleanflight/%s %s %s / %s (%s)",
|
||||
printf("# Cleanflight/%s %s %s / %s (%s)",
|
||||
targetName,
|
||||
FC_VERSION_STRING,
|
||||
buildDate,
|
||||
|
@ -1710,6 +1710,13 @@ void cliProcess(void)
|
|||
clicmd_t target;
|
||||
cliPrint("\r\n");
|
||||
|
||||
// Strip comment starting with # from line
|
||||
char *p = cliBuffer;
|
||||
p = strchr(++p, '#');
|
||||
if (NULL != p) {
|
||||
bufferIndex = (uint32_t)(p - cliBuffer);
|
||||
}
|
||||
|
||||
// Strip trailing whitespace
|
||||
while (bufferIndex > 0 && cliBuffer[bufferIndex - 1] == ' ') {
|
||||
bufferIndex--;
|
||||
|
|
Loading…
Reference in New Issue