]> git.zerfleddert.de Git - proxmark3-svn/blame_incremental - client/cmdmain.c
Comms refactor (prerequisite of libproxmark work) (#371)
[proxmark3-svn] / client / cmdmain.c
... / ...
CommitLineData
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#include "cmdcrc.h"
31
32
33unsigned int current_command = CMD_UNKNOWN;
34
35static int CmdHelp(const char *Cmd);
36static int CmdQuit(const char *Cmd);
37static int CmdRev(const char *Cmd);
38
39
40static command_t CommandTable[] =
41{
42 {"help", CmdHelp, 1, "This help. Use '<command> help' for details of a particular command."},
43 {"data", CmdData, 1, "{ Plot window / data buffer manipulation... }"},
44 {"hf", CmdHF, 1, "{ High Frequency commands... }"},
45 {"hw", CmdHW, 1, "{ Hardware commands... }"},
46 {"lf", CmdLF, 1, "{ Low Frequency commands... }"},
47 {"reveng",CmdRev, 1, "Crc calculations from the software reveng1-30"},
48 {"script",CmdScript,1, "{ Scripting commands }"},
49 {"quit", CmdQuit, 1, "Exit program"},
50 {"exit", CmdQuit, 1, "Exit program"},
51 {NULL, NULL, 0, NULL}
52};
53
54command_t* getTopLevelCommandTable()
55{
56 return CommandTable;
57}
58
59int CmdHelp(const char *Cmd)
60{
61 CmdsHelp(CommandTable);
62 return 0;
63}
64
65int CmdQuit(const char *Cmd)
66{
67 return 99;
68}
69
70int CmdRev(const char *Cmd)
71{
72 CmdCrc(Cmd);
73 return 0;
74}
75
76//-----------------------------------------------------------------------------
77// Entry point into our code: called whenever the user types a command and
78// then presses Enter, which the full command line that they typed.
79//-----------------------------------------------------------------------------
80int CommandReceived(char *Cmd) {
81 return CmdsParse(CommandTable, Cmd);
82}
83
Impressum, Datenschutz