]>
Commit | Line | Data |
---|---|---|
fe81b478 | 1 | //----------------------------------------------------------------------------- |
2 | // Copyright (C) 2015 iceman <iceman at iuse.se> | |
3 | // | |
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 | |
6 | // the license. | |
7 | //----------------------------------------------------------------------------- | |
8 | // CRC Calculations from the software reveng commands | |
9 | //----------------------------------------------------------------------------- | |
10 | ||
11 | #include <stdio.h> | |
12 | #include <string.h> | |
13 | #include "cmdmain.h" | |
14 | #include "cmdparser.h" | |
15 | #include "cmdcrc.h" | |
16 | #include "reveng/reveng.h" | |
17 | //#include "reveng/cli.h" | |
18 | static int CmdHelp(const char *Cmd); | |
19 | ||
20 | int CmdCrcCalc(const char *Cmd) | |
21 | { | |
22 | int argc = 0; | |
23 | char Cmd2[CMD_BUFFER_SIZE] = {0x00}; | |
24 | char *argv[3]; | |
25 | ||
26 | for (int i = 0; i < 50; i++) | |
27 | if (Cmd[i]==0x00) argc=i; | |
28 | ||
29 | memcpy(Cmd2, Cmd, argc); | |
30 | argv[1]=Cmd2; | |
31 | reveng_main(argc, argv); | |
32 | return 0; | |
33 | } | |
34 | ||
35 | static command_t CommandTable[] = | |
36 | { | |
37 | {"help", CmdHelp, 1, "This help"}, | |
38 | {"calc", CmdCrcCalc, 1, "{ Calculate CRC's }"}, | |
39 | {NULL, NULL, 0, NULL} | |
40 | }; | |
41 | ||
42 | int CmdCrc(const char *Cmd) | |
43 | { | |
44 | CmdsParse(CommandTable, Cmd); | |
45 | return 0; | |
46 | } | |
47 | ||
48 | int CmdHelp(const char *Cmd) | |
49 | { | |
50 | CmdsHelp(CommandTable); | |
51 | return 0; | |
52 | } |