]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/util.c
ADD: new found cloner pwd.
[proxmark3-svn] / client / util.c
index b2ac82ae1d9522a58f0d2c6ef9e8a04459930aed..0d24ac8ee32ae44dfe93cf4245274185ee580e57 100644 (file)
@@ -12,9 +12,6 @@
 #define MAX_BIN_BREAK_LENGTH   (3072+384+1)
 
 #ifndef _WIN32
-#include <termios.h>
-#include <sys/ioctl.h> 
-
 int ukbhit(void) {
   int cnt = 0;
   int error;
@@ -38,7 +35,6 @@ int ukbhit(void) {
 }
 
 #else
-#include <conio.h>
 int ukbhit(void) {
        return kbhit();
 }
@@ -63,7 +59,10 @@ void AddLogLine(char *file, char *extData, char *c) {
        fprintf(f, "%s", extData);
        fprintf(f, "%s\n", c);
        fflush(f);
-       fclose(f);
+       if (f) {
+               fclose(f);
+               f = NULL;
+       }
 }
 
 void AddLogHex(char *fileName, char *extData, const uint8_t * data, const size_t len){
@@ -186,7 +185,7 @@ char *sprint_hex_ascii(const uint8_t *data, const size_t len) {
 
 void num_to_bytes(uint64_t n, size_t len, uint8_t* dest) {
        while (len--) {
-               dest[len] = (uint8_t) n;
+               dest[len] = n & 0xFF;
                n >>= 8;
        }
 }
@@ -280,7 +279,6 @@ int param_getptr(const char *line, int *bg, int *en, int paramnum)
        return 0;
 }
 
-
 char param_getchar(const char *line, int paramnum)
 {
        int bg, en;
Impressum, Datenschutz