changeset 107:6e3201b2c68b

Fixing CLI command processing bug. - Issue with the first space delimiter before the args
author Jacob Alexander <haata@kiibohd.com>
date Wed, 22 Jan 2014 01:10:32 -0800
parents 15961894eaeb
children ecb57880e3bc
files Debug/cli/cli.c
diffstat 1 files changed, 5 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- 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++ )