# HG changeset patch # User Jacob Alexander # Date 1390381832 28800 # Node ID 6e3201b2c68b3bfe0768865434c123094ceeddce # Parent 15961894eaebc0ca4c2f2625697533e14a8f5610 Fixing CLI command processing bug. - Issue with the first space delimiter before the args diff -r 15961894eaeb -r 6e3201b2c68b Debug/cli/cli.c --- a/Debug/cli/cli.c Wed Jan 22 00:38:53 2014 -0800 +++ b/Debug/cli/cli.c Wed Jan 22 01:10:32 2014 -0800 @@ -186,14 +186,13 @@ char* cmdPtr = CLILineBuffer - 1; while ( *++cmdPtr == ' ' ); // Skips leading spaces, and points to first character of cmd - // Locates first space delimiter, and points to first character of args or a NULL (no args) - char* argPtr = cmdPtr; - do { + // Locates first space delimiter + char* argPtr = cmdPtr + 1; + while ( *argPtr != ' ' && *argPtr != '\0' ) argPtr++; - } while ( *argPtr != ' ' && *argPtr != '\0' ); - // Set the space delimiter as a NULL - argPtr[-1] = '\0'; + // Point to the first character of args or a NULL (no args) and set the space delimiter as a NULL + (++argPtr)[-1] = '\0'; // Scan array of dictionaries for a valid command match for ( uint8_t dict = 0; dict < CLIDictionariesUsed; dict++ )