mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-08-21 22:03:19 -07:00
modify argtable parser to parse ints with spaces
This commit is contained in:
parent
2d4db38754
commit
2ff07208fd
2 changed files with 17 additions and 3 deletions
|
@ -99,7 +99,7 @@ int CLIParserParseString(const char* str, void* vargtable[], size_t vargtableLen
|
|||
for (int i = 0; i < len; i++) {
|
||||
switch(state){
|
||||
case PS_FIRST: // first char
|
||||
if (str[i] == '-'){ // first char before space is '-' - next element - option
|
||||
if (true/*str[i] == '-'*/){ // first char before space is '-' - next element - option
|
||||
state = PS_OPTION;
|
||||
|
||||
if (spaceptr) {
|
||||
|
@ -148,7 +148,21 @@ void CLIParserFree() {
|
|||
|
||||
// convertors
|
||||
int CLIParamHexToBuf(struct arg_str *argstr, uint8_t *data, int maxdatalen, int *datalen) {
|
||||
switch(param_gethex_to_eol(argstr->sval[0], 0, data, maxdatalen, datalen)) {
|
||||
*datalen = 0;
|
||||
if (!argstr->count)
|
||||
return 0;
|
||||
|
||||
char buf[256] = {0};
|
||||
int ibuf = 0;
|
||||
|
||||
for (int i = 0; i < argstr->count; i++) {
|
||||
int len = strlen(argstr->sval[i]);
|
||||
memcpy(&buf[ibuf], argstr->sval[i], len);
|
||||
ibuf += len;
|
||||
}
|
||||
buf[ibuf] = 0;
|
||||
|
||||
switch(param_gethex_to_eol(buf, 0, data, maxdatalen, datalen)) {
|
||||
case 1:
|
||||
printf("Parameter error: Invalid HEX value.\n");
|
||||
return 1;
|
||||
|
|
|
@ -807,7 +807,7 @@ int CmdHF14ACmdRaw(const char *cmd) {
|
|||
arg_int0("t", "timeout", NULL, "timeout in ms"),
|
||||
arg_lit0("T", "topaz", "use Topaz protocol to send command"),
|
||||
arg_lit0("3", NULL, "ISO14443-3 select only (skip RATS)"),
|
||||
arg_str1(NULL, NULL, "<data (hex)>", NULL),
|
||||
arg_strn(NULL, NULL, "<data (hex)>", 1, 250, NULL),
|
||||
arg_param_end
|
||||
};
|
||||
// defaults
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue