client/cmdparser.c: Remove the leading spaces before calling the subparser. client/cmdlfhid.c: Modify accordingly.

This commit is contained in:
izsh@fail0verflow.com 2010-03-06 00:30:24 +00:00
parent f443ff3ebc
commit 035303ac5f
2 changed files with 6 additions and 3 deletions

View file

@ -46,7 +46,7 @@ int CmdHIDDemodFSK(const char *Cmd)
int CmdHIDSim(const char *Cmd) int CmdHIDSim(const char *Cmd)
{ {
unsigned int hi = 0, lo = 0; unsigned int hi = 0, lo = 0;
int n = 0, i = 1; int n = 0, i = 0;
while (sscanf(&Cmd[i++], "%1x", &n ) == 1) { while (sscanf(&Cmd[i++], "%1x", &n ) == 1) {
hi = (hi << 4) | (lo >> 28); hi = (hi << 4) | (lo >> 28);

View file

@ -50,9 +50,12 @@ void CmdsParse(const command_t Commands[], const char *Cmd)
if(matches == 1) i=last_match; if(matches == 1) i=last_match;
} }
if (Commands[i].Name) if (Commands[i].Name) {
while (Cmd[len] == ' ')
++len;
Commands[i].Parse(Cmd + len); Commands[i].Parse(Cmd + len);
else } else {
// show help (always first in array) for selected hierarchy or if command not recognised // show help (always first in array) for selected hierarchy or if command not recognised
CmdsHelp(Commands); CmdsHelp(Commands);
}
} }