]>
cvs.zerfleddert.de Git - proxmark3-svn/blob - client/cmdcrc.c
984815d98a9377876dafc12e21c13ec0c7c1d0a7
1 //-----------------------------------------------------------------------------
2 // Copyright (C) 2015 iceman <iceman at iuse.se>
4 // This code is licensed to you under the terms of the GNU GPL, version 2 or,
5 // at your option, any later version. See the LICENSE.txt file for the text of
7 //-----------------------------------------------------------------------------
8 // CRC Calculations from the software reveng commands
9 //-----------------------------------------------------------------------------
17 #include "reveng/reveng.h"
23 int split(char *str
, char *arr
[MAX_ARGS
]){
26 int maxWords
= MAX_ARGS
;
30 while(isspace(str
[beginIndex
])){
33 if(str
[beginIndex
] == '\0')
35 endIndex
= beginIndex
;
36 while (str
[endIndex
] && !isspace(str
[endIndex
])){
39 int len
= endIndex
- beginIndex
;
40 char *tmp
= calloc(len
+ 1, sizeof(char));
41 memcpy(tmp
, &str
[beginIndex
], len
);
43 //PrintAndLog("cnt: %d, %s",wordCnt-1, arr[wordCnt-1]);
44 beginIndex
= endIndex
;
45 if (wordCnt
== maxWords
)
51 int CmdCrc(const char *Cmd
)
53 char name
[] = {"reveng "};
55 memcpy(Cmd2
, name
, 7);
56 memcpy(Cmd2
+ 7, Cmd
, 50);
58 int argc
= split(Cmd2
, argv
);
59 //PrintAndLog("argc: %d, %s %s Cmd: %s",argc, argv[0], Cmd2, Cmd);
60 reveng_main(argc
, argv
);
61 for(int i
= 0; i
< argc
; ++i
){