]> git.zerfleddert.de Git - proxmark3-svn/blob - client/cmdmain.c
USB comm: prepare for @micolous change (PR#463) (#587)
[proxmark3-svn] / client / cmdmain.c
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 "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"
27 #include "util.h"
28 #include "util_posix.h"
29 #include "cmdscript.h"
30
31
32 unsigned int current_command = CMD_UNKNOWN;
33
34 static int CmdHelp(const char *Cmd);
35 static int CmdQuit(const char *Cmd);
36
37
38 static command_t CommandTable[] =
39 {
40 {"help", CmdHelp, 1, "This help. Use '<command> help' for details of a particular command."},
41 {"data", CmdData, 1, "{ Plot window / data buffer manipulation... }"},
42 {"hf", CmdHF, 1, "{ High Frequency commands... }"},
43 {"hw", CmdHW, 1, "{ Hardware commands... }"},
44 {"lf", CmdLF, 1, "{ Low Frequency commands... }"},
45 {"script",CmdScript,1, "{ Scripting commands }"},
46 {"quit", CmdQuit, 1, "Exit program"},
47 {"exit", CmdQuit, 1, "Exit program"},
48 {NULL, NULL, 0, NULL}
49 };
50
51 command_t* getTopLevelCommandTable()
52 {
53 return CommandTable;
54 }
55
56 int CmdHelp(const char *Cmd)
57 {
58 CmdsHelp(CommandTable);
59 return 0;
60 }
61
62 int CmdQuit(const char *Cmd)
63 {
64 return 99;
65 }
66
67 //-----------------------------------------------------------------------------
68 // Entry point into our code: called whenever the user types a command and
69 // then presses Enter, which the full command line that they typed.
70 //-----------------------------------------------------------------------------
71 int CommandReceived(char *Cmd) {
72 return CmdsParse(CommandTable, Cmd);
73 }
74
Impressum, Datenschutz