From 035303ac5f3e5e38cfa79a3a4c0d0bf76e70bd6b Mon Sep 17 00:00:00 2001 From: "izsh@fail0verflow.com" Date: Sat, 6 Mar 2010 00:30:24 +0000 Subject: [PATCH] client/cmdparser.c: Remove the leading spaces before calling the subparser. client/cmdlfhid.c: Modify accordingly. --- client/cmdlfhid.c | 2 +- client/cmdparser.c | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/client/cmdlfhid.c b/client/cmdlfhid.c index eb0d83a9..344662e1 100644 --- a/client/cmdlfhid.c +++ b/client/cmdlfhid.c @@ -46,7 +46,7 @@ int CmdHIDDemodFSK(const char *Cmd) int CmdHIDSim(const char *Cmd) { unsigned int hi = 0, lo = 0; - int n = 0, i = 1; + int n = 0, i = 0; while (sscanf(&Cmd[i++], "%1x", &n ) == 1) { hi = (hi << 4) | (lo >> 28); diff --git a/client/cmdparser.c b/client/cmdparser.c index 0f97d7fe..4f6e2463 100644 --- a/client/cmdparser.c +++ b/client/cmdparser.c @@ -50,9 +50,12 @@ void CmdsParse(const command_t Commands[], const char *Cmd) if(matches == 1) i=last_match; } - if (Commands[i].Name) + if (Commands[i].Name) { + while (Cmd[len] == ' ') + ++len; Commands[i].Parse(Cmd + len); - else + } else { // show help (always first in array) for selected hierarchy or if command not recognised CmdsHelp(Commands); + } } -- 2.39.2