X-Git-Url: http://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/4cd41f34ead6351f3b0a897453b25c036021c53f..51969283ec562f968d997a5581724d86d3e8b1d4:/client/proxmark3.c diff --git a/client/proxmark3.c b/client/proxmark3.c index 9873f26a..9105ca62 100644 --- a/client/proxmark3.c +++ b/client/proxmark3.c @@ -1,7 +1,19 @@ +//----------------------------------------------------------------------------- +// Copyright (C) 2009 Michael Gernoth +// Copyright (C) 2010 iZsh +// +// This code is licensed to you under the terms of the GNU GPL, version 2 or, +// at your option, any later version. See the LICENSE.txt file for the text of +// the license. +//----------------------------------------------------------------------------- +// Main binary +//----------------------------------------------------------------------------- + #include #include #include #include +#include #include #include #include "proxusb.h" @@ -26,10 +38,7 @@ static void *usb_receiver(void *targ) while (arg->run) { if (ReceiveCommandPoll(&cmdbuf)) { - for (int i = 0; i < strlen(PROXPROMPT); i++) - putchar(0x08); UsbCommandReceived(&cmdbuf); - printf(PROXPROMPT); fflush(NULL); } } @@ -50,19 +59,29 @@ static void *main_loop(void *targ) pthread_create(&reader_thread, NULL, &usb_receiver, &rarg); } - while(1) { - cmd = readline(PROXPROMPT); - if (cmd) { - if (cmd[0] != 0x00) { - CommandReceived(cmd); - add_history(cmd); - } - free(cmd); - } else { - printf("\n"); - break; - } - } + read_history(".history"); + while(1) { + cmd = readline(PROXPROMPT); + if (cmd) { + while(cmd[strlen(cmd) - 1] == ' ') + cmd[strlen(cmd) - 1] = 0x00; + + if (cmd[0] != 0x00) { + if (strncmp(cmd, "quit", 4) == 0) { + break; + } + + CommandReceived(cmd); + add_history(cmd); + } + free(cmd); + } else { + printf("\n"); + break; + } + } + + write_history(".history"); if (arg->usb_present == 1) { rarg.run = 0;