mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-08-22 22:23:38 -07:00
compress some code. lets look.
This commit is contained in:
parent
2d5cb77890
commit
f5a1e26f9f
2 changed files with 17 additions and 5 deletions
|
@ -11,6 +11,9 @@
|
||||||
#include "argtable3.h"
|
#include "argtable3.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
|
#define arg_get_lit(n)(((struct arg_lit*)argtable[n]))
|
||||||
|
#define arg_get_str(n)(((struct arg_str*)argtable[n]))
|
||||||
|
|
||||||
extern int CLParserInit(char *vprogramName, char *vprogramHint);
|
extern int CLParserInit(char *vprogramName, char *vprogramHint);
|
||||||
extern int CLParserParseString(const char* str, void* argtable[], size_t vargtableLen);
|
extern int CLParserParseString(const char* str, void* argtable[], size_t vargtableLen);
|
||||||
extern int CLParserParseArg(int argc, char **argv, void* argtable[], size_t vargtableLen);
|
extern int CLParserParseArg(int argc, char **argv, void* argtable[], size_t vargtableLen);
|
||||||
|
|
|
@ -728,21 +728,30 @@ int CmdHF14AAPDU(const char *cmd) {
|
||||||
bool decodeTLV = false;
|
bool decodeTLV = false;
|
||||||
|
|
||||||
CLParserInit("hf 14a apdu", "Send ISO 14443-4 APDU to tag");
|
CLParserInit("hf 14a apdu", "Send ISO 14443-4 APDU to tag");
|
||||||
struct arg_lit *ahelp = arg_lit0("hH", "help", "print this help and exit");
|
/*struct arg_lit *ahelp = arg_lit0("hH", "help", "print this help and exit");
|
||||||
struct arg_lit *as = arg_lit0("sS", "select", "activate field and select card");
|
struct arg_lit *as = arg_lit0("sS", "select", "activate field and select card");
|
||||||
struct arg_lit *ak = arg_lit0("kK", "keep", "leave the signal field ON after receive response");
|
struct arg_lit *ak = arg_lit0("kK", "keep", "leave the signal field ON after receive response");
|
||||||
struct arg_lit *at = arg_lit0("tT", "tlv", "executes TLV decoder if it possible");
|
struct arg_lit *at = arg_lit0("tT", "tlv", "executes TLV decoder if it possible");
|
||||||
struct arg_str *astr = arg_str1(NULL, NULL, "<APDU (hex)>", NULL);
|
struct arg_str *astr = arg_str1(NULL, NULL, "<APDU (hex)>", NULL);
|
||||||
struct arg_end *aend = arg_end(20);
|
struct arg_end *aend = arg_end(20);
|
||||||
void* argtable[] = {ahelp, as, ak, at, astr, aend};
|
void* argtable[] = {ahelp, as, ak, at, astr, aend};
|
||||||
|
*/
|
||||||
|
void* argtable[] = {
|
||||||
|
arg_lit0("hH", "help", "print this help and exit"),
|
||||||
|
arg_lit0("sS", "select", "activate field and select card"),
|
||||||
|
arg_lit0("kK", "keep", "leave the signal field ON after receive response"),
|
||||||
|
arg_lit0("tT", "tlv", "executes TLV decoder if it possible"),
|
||||||
|
arg_str1(NULL, NULL, "<APDU (hex)>", NULL),
|
||||||
|
arg_end(20)
|
||||||
|
};
|
||||||
if (CLParserParseString(cmd, argtable, sizeof(argtable) / sizeof(argtable[0])))
|
if (CLParserParseString(cmd, argtable, sizeof(argtable) / sizeof(argtable[0])))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
activateField = as->count;
|
activateField = arg_get_lit(1)->count;
|
||||||
leaveSignalON = ak->count;
|
leaveSignalON = arg_get_lit(2)->count;
|
||||||
decodeTLV = at->count;
|
decodeTLV = arg_get_lit(3)->count;
|
||||||
// len = data + PCB(1b) + CRC(2b)
|
// len = data + PCB(1b) + CRC(2b)
|
||||||
if (CLParamHexToBuf(astr, data, sizeof(data) - 1 -2, &datalen))
|
if (CLParamHexToBuf(arg_get_str(4), data, sizeof(data) - 1 -2, &datalen))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
CLParserFree();
|
CLParserFree();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue