The CommandProcessor is the interface to install a run-time menu into an embedded system.
Dependents: A_CANAdapter USB2I2C
Diff: CommandProcessor.c
- Revision:
- 16:4ce4f55213ac
- Parent:
- 15:5f30da93e3e2
--- a/CommandProcessor.c Sun Oct 30 19:57:39 2011 +0000 +++ b/CommandProcessor.c Mon Oct 31 00:36:18 2011 +0000 @@ -248,10 +248,10 @@ space = strchr(buffer, ' '); // if the command has parameters, find the delimiter if (space) { compareLength = space - buffer; - space++; // char after the space + space++; // advance to the char after the space (where the params may start) } else { compareLength = strlen(buffer); - space = buffer + compareLength; + space = buffer + compareLength; // points to the NULL terminator } while (link && link->menu) { int cmpResult; @@ -287,6 +287,13 @@ strcpy(buffer, alternateBuffer); free(alternateBuffer); EchoString(p); + *params = strchr(buffer, ' '); // if the command has parameters, find the delimiter + if (*params) { + (*params)++; // advance to the char after the space (where the params may start) + } else { + compareLength = strlen(buffer); + *params = buffer + compareLength; // points to the NULL terminator + } } } }