]>
git.zerfleddert.de Git - proxmark3-svn/blob - client/cmdparser.c
6 void CmdsHelp(const command_t Commands
[])
8 if (Commands
[0].Name
== NULL
)
11 while (Commands
[i
].Name
)
13 if (!offline
|| Commands
[i
].Offline
)
14 PrintAndLog("%-16s %s", Commands
[i
].Name
, Commands
[i
].Help
);
19 void CmdsParse(const command_t Commands
[], const char *Cmd
)
23 memset(cmd_name
, 0, 32);
24 sscanf(Cmd
, "%31s%n", cmd_name
, &len
);
26 while (Commands
[i
].Name
&& strcmp(Commands
[i
].Name
, cmd_name
))
29 /* try to find exactly one prefix-match */
30 if(!Commands
[i
].Name
) {
34 for(i
=0;Commands
[i
].Name
;i
++) {
35 if( !strncmp(Commands
[i
].Name
, cmd_name
, strlen(cmd_name
)) ) {
40 if(matches
== 1) i
=last_match
;
44 Commands
[i
].Parse(Cmd
+ len
);
46 // show help (always first in array) for selected hierarchy or if command not recognised