X-Git-Url: http://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/f7e3ed82874bfd8951c90536bd7185d599d6dbf8..bd20f8f47847787e1f3e933043933272908c5beb:/armsrc/util.c diff --git a/armsrc/util.c b/armsrc/util.c index ae6408cf..5a8cfeec 100644 --- a/armsrc/util.c +++ b/armsrc/util.c @@ -1,68 +1,16 @@ //----------------------------------------------------------------------------- -// Utility functions used in many places, not specific to any piece of code. // Jonathan Westhues, Sept 2005 +// +// This code is licensed to you under the terms of the GNU GPL, version 2 or, +// at your option, any later version. See the LICENSE.txt file for the text of +// the license. +//----------------------------------------------------------------------------- +// Utility functions used in many places, not specific to any piece of code. //----------------------------------------------------------------------------- + #include "proxmark3.h" #include "util.h" - -void *memcpy(void *dest, const void *src, int len) -{ - uint8_t *d = dest; - const uint8_t *s = src; - while((len--) > 0) { - *d = *s; - d++; - s++; - } - return dest; -} - -void *memset(void *dest, int c, int len) -{ - uint8_t *d = dest; - while((len--) > 0) { - *d = c; - d++; - } - return dest; -} - -int memcmp(const void *av, const void *bv, int len) -{ - const uint8_t *a = av; - const uint8_t *b = bv; - - while((len--) > 0) { - if(*a != *b) { - return *a - *b; - } - a++; - b++; - } - return 0; -} - -int strlen(const char *str) -{ - int l = 0; - while(*str) { - l++; - str++; - } - return l; -} - -char* strncat(char *dest, const char *src, unsigned int n) -{ - unsigned int dest_len = strlen(dest); - unsigned int i; - - for (i = 0 ; i < n && src[i] != '\0' ; i++) - dest[dest_len + i] = src[i]; - dest[dest_len + i] = '\0'; - - return dest; -} +#include "string.h" void num_to_bytes(uint64_t n, size_t len, uint8_t* dest) {