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