X-Git-Url: http://cvs.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/873014de8a4be0f68524531cc90fe6c1dfdffded..cee48e2b4439f4bc9e9303a606ecee857fab1b12:/client/util.c diff --git a/client/util.c b/client/util.c index 6825d721..ae213e43 100644 --- a/client/util.c +++ b/client/util.c @@ -14,7 +14,7 @@ #include #include "util.h" -#ifdef __linux__ +#ifndef WIN32 #include #include int ukbhit(void) @@ -89,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 @@ -190,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; +}