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