X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/f397b5cc874ac7d658173199d92c30f3f717a300..fa4a296451175b0c287f74f0e595a9d408732d0b:/client/util.c?ds=sidebyside diff --git a/client/util.c b/client/util.c index 8e7ef01b..ae213e43 100644 --- a/client/util.c +++ b/client/util.c @@ -14,7 +14,9 @@ #include #include "util.h" -#ifdef __linux__ +#ifndef WIN32 +#include +#include 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 @@ -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; +}