]> git.zerfleddert.de Git - proxmark3-svn/blame - client/cli.c
marcan's patch until he gets commit access. Remove C library's includes from the...
[proxmark3-svn] / client / cli.c
CommitLineData
db917a16 1#include <stdio.h>
7fe9b0b7 2#include "ui.h"
3#include "proxusb.h"
4#include "cmdmain.h"
db917a16 5
6#define HANDLE_ERROR if (error_occured) { \
7fe9b0b7 7 error_occured = 0;\
8 break;\
db917a16 9}
10
11int main(int argc, char **argv)
12{
7fe9b0b7 13 if (argc != 3 && argc != 4)
14 {
15 printf("\n\tusage: cli <command 1> <command 2> [logfile (default cli.log)]\n");
16 printf("\n");
17 printf("\texample: cli hi14asnoop hi14alist h14a.log\n");
18 printf("\n");
19 return -1;
20 }
21
22 usb_init();
23 if (argc == 4)
24 SetLogFilename(argv[3]);
25 else
26 SetLogFilename("cli.log");
27
28 return_on_error = 1;
29
30 while (1) {
31 while (!OpenProxmark(0)) { sleep(1); }
32 while (1) {
33 UsbCommand cmdbuf;
34 CommandReceived(argv[1]);
35 HANDLE_ERROR;
36 ReceiveCommand(&cmdbuf);
37 HANDLE_ERROR;
38 for (int i = 0; i < 5; ++i) {
39 ReceiveCommandPoll(&cmdbuf);
40 }
41 HANDLE_ERROR;
42 CommandReceived(argv[2]);
43 HANDLE_ERROR;
44 }
45 }
46
47 CloseProxmark();
48 return 0;
db917a16 49}
Impressum, Datenschutz