]> git.donarmstrong.com Git - kiibohd-controller.git/commitdiff
Fixing CLI command processing bug.
authorJacob Alexander <haata@kiibohd.com>
Wed, 22 Jan 2014 09:10:32 +0000 (01:10 -0800)
committerJacob Alexander <haata@kiibohd.com>
Sat, 22 Mar 2014 21:10:52 +0000 (14:10 -0700)
- Issue with the first space delimiter before the args

Debug/cli/cli.c

index b69bdf0dd42a8e2c3cff04deae5fb1881eccd396..ce843d6d6b492efc52681f25664e15ced5a0347e 100644 (file)
@@ -186,14 +186,13 @@ void commandLookup_cli()
        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++ )