]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/proxmark3.c
Fixes to Mifare nested function...
[proxmark3-svn] / client / proxmark3.c
index 17534558bbd9c17ee9a8390c568252ab84ac315e..9105ca62b8acc7ce1f808de59477a291537b1550 100644 (file)
@@ -13,6 +13,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <pthread.h>
+#include <unistd.h>
 #include <readline/readline.h>
 #include <readline/history.h>
 #include "proxusb.h"
@@ -37,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);
     }
   }
@@ -61,21 +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) {
-        while(cmd[strlen(cmd) - 1] == ' ')
-          cmd[strlen(cmd) - 1]= 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;
Impressum, Datenschutz