Add Smartcard functions (RDV4.0) (#646)
[proxmark3-svn] / client / cmdmain.c
CommitLineData
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 "usb_cmd.h"
21#include "ui.h"
22#include "cmdhf.h"
23#include "cmddata.h"
24#include "cmdhw.h"
25#include "cmdlf.h"
9440213d 26#include "util.h"
ec9c7112 27#include "util_posix.h"
1d59cd8d 28#include "cmdscript.h"
43591e64 29#ifdef WITH_SMARTCARD
30 #include "cmdsmartcard.h"
31#endif
e772353f 32
7fe9b0b7 33static int CmdHelp(const char *Cmd);
34static int CmdQuit(const char *Cmd);
cf9aa77d 35
fd368d18 36
7fe9b0b7 37static command_t CommandTable[] =
38{
57c69556 39 {"help", CmdHelp, 1, "This help. Use '<command> help' for details of a particular command."},
37239a7c 40 {"data", CmdData, 1, "{ Plot window / data buffer manipulation... }"},
fe81b478 41 {"hf", CmdHF, 1, "{ High Frequency commands... }"},
37239a7c 42 {"hw", CmdHW, 1, "{ Hardware commands... }"},
fe81b478 43 {"lf", CmdLF, 1, "{ Low Frequency commands... }"},
43591e64 44#ifdef WITH_SMARTCARD
45 {"sc", CmdSmartcard,1,"{ Smartcard commands... }"},
46#endif
f46c3663 47 {"script",CmdScript,1, "{ Scripting commands }"},
57c69556
MHS
48 {"quit", CmdQuit, 1, "Exit program"},
49 {"exit", CmdQuit, 1, "Exit program"},
7fe9b0b7 50 {NULL, NULL, 0, NULL}
51};
52
57c69556
MHS
53command_t* getTopLevelCommandTable()
54{
55 return CommandTable;
56}
f5ecd97b 57
ad939de5 58static int CmdHelp(const char *Cmd)
7fe9b0b7 59{
60 CmdsHelp(CommandTable);
61 return 0;
62}
63
ad939de5 64static int CmdQuit(const char *Cmd)
7fe9b0b7 65{
2487dfeb 66 return 99;
7fe9b0b7 67}
f46c3663 68
7fe9b0b7 69//-----------------------------------------------------------------------------
70// Entry point into our code: called whenever the user types a command and
71// then presses Enter, which the full command line that they typed.
72//-----------------------------------------------------------------------------
2487dfeb 73int CommandReceived(char *Cmd) {
74 return CmdsParse(CommandTable, Cmd);
7fe9b0b7 75}
76
Impressum, Datenschutz