]>
Commit | Line | Data |
---|---|---|
1 | //----------------------------------------------------------------------------- | |
2 | // Copyright (C) 2010 iZsh <izsh at fail0verflow.com> | |
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 | // Main command parser entry point | |
9 | //----------------------------------------------------------------------------- | |
10 | ||
11 | #include "cmdmain.h" | |
12 | ||
13 | #include <pthread.h> | |
14 | #include <stdio.h> | |
15 | #include <stdlib.h> | |
16 | #include <unistd.h> | |
17 | #include <string.h> | |
18 | #include "cmdparser.h" | |
19 | #include "proxmark3.h" | |
20 | #include "usb_cmd.h" | |
21 | #include "ui.h" | |
22 | #include "cmdhf.h" | |
23 | #include "cmddata.h" | |
24 | #include "cmdhw.h" | |
25 | #include "cmdlf.h" | |
26 | #include "util.h" | |
27 | #include "util_posix.h" | |
28 | #include "cmdscript.h" | |
29 | ||
30 | ||
31 | static int CmdHelp(const char *Cmd); | |
32 | static int CmdQuit(const char *Cmd); | |
33 | ||
34 | ||
35 | static command_t CommandTable[] = | |
36 | { | |
37 | {"help", CmdHelp, 1, "This help. Use '<command> help' for details of a particular command."}, | |
38 | {"data", CmdData, 1, "{ Plot window / data buffer manipulation... }"}, | |
39 | {"hf", CmdHF, 1, "{ High Frequency commands... }"}, | |
40 | {"hw", CmdHW, 1, "{ Hardware commands... }"}, | |
41 | {"lf", CmdLF, 1, "{ Low Frequency commands... }"}, | |
42 | {"script",CmdScript,1, "{ Scripting commands }"}, | |
43 | {"quit", CmdQuit, 1, "Exit program"}, | |
44 | {"exit", CmdQuit, 1, "Exit program"}, | |
45 | {NULL, NULL, 0, NULL} | |
46 | }; | |
47 | ||
48 | command_t* getTopLevelCommandTable() | |
49 | { | |
50 | return CommandTable; | |
51 | } | |
52 | ||
53 | static int CmdHelp(const char *Cmd) | |
54 | { | |
55 | CmdsHelp(CommandTable); | |
56 | return 0; | |
57 | } | |
58 | ||
59 | static int CmdQuit(const char *Cmd) | |
60 | { | |
61 | return 99; | |
62 | } | |
63 | ||
64 | //----------------------------------------------------------------------------- | |
65 | // Entry point into our code: called whenever the user types a command and | |
66 | // then presses Enter, which the full command line that they typed. | |
67 | //----------------------------------------------------------------------------- | |
68 | int CommandReceived(char *Cmd) { | |
69 | return CmdsParse(CommandTable, Cmd); | |
70 | } | |
71 |