]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/util.c
fixed a lot of simulation issues
[proxmark3-svn] / client / util.c
index 8e7ef01b10d63d37f4beb75bfeaba10baaafa246..be947b8ade4dc57461b7ccadc210fd4438ab7f19 100644 (file)
@@ -14,7 +14,9 @@
 #include <ctype.h>
 #include "util.h"
 
-#ifdef __linux__
+#ifndef WIN32
+#include <termios.h>
+#include <sys/ioctl.h> 
 int ukbhit(void)
 {
   int cnt = 0;
@@ -87,6 +89,10 @@ uint64_t bytes_to_num(uint8_t* src, size_t len)
        return num;
 }
 
+//  -------------------------------------------------------------------------
+//  string parameters lib
+//  -------------------------------------------------------------------------
+
 //  -------------------------------------------------------------------------
 //  line     - param line
 //  bg, en   - symbol numbers in param line of beginning an ending parameter
@@ -160,7 +166,7 @@ uint64_t param_get64ex(const char *line, int paramnum, int deflt, int base)
        int bg, en;
 
        if (!param_getptr(line, &bg, &en, paramnum)) 
-               return strtol(&line[bg], NULL, base);
+               return strtoll(&line[bg], NULL, base);
        else
                return deflt;
 
@@ -188,3 +194,15 @@ int param_gethex(const char *line, int paramnum, uint8_t * data, int hexcnt)
 
        return 0;
 }
+
+int param_getstr(const char *line, int paramnum, char * str)
+{
+       int bg, en;
+
+       if (param_getptr(line, &bg, &en, paramnum)) return 0;
+       
+       memcpy(str, line + bg, en - bg + 1);
+       str[en - bg + 1] = 0;
+       
+       return en - bg + 1;
+}
Impressum, Datenschutz