]> cvs.zerfleddert.de Git - proxmark3-svn/blob - armsrc/util.c
add 'detectreader' command - listen for external reader fields
[proxmark3-svn] / armsrc / util.c
1 //-----------------------------------------------------------------------------
2 // Utility functions used in many places, not specific to any piece of code.
3 // Jonathan Westhues, Sept 2005
4 //-----------------------------------------------------------------------------
5 #include <proxmark3.h>
6 #include "apps.h"
7
8 void *memcpy(void *dest, const void *src, int len)
9 {
10 BYTE *d = dest;
11 const BYTE *s = src;
12 while((len--) > 0) {
13 *d = *s;
14 d++;
15 s++;
16 }
17 return dest;
18 }
19
20 void *memset(void *dest, int c, int len)
21 {
22 BYTE *d = dest;
23 while((len--) > 0) {
24 *d = c;
25 d++;
26 }
27 return dest;
28 }
29
30 int memcmp(const void *av, const void *bv, int len)
31 {
32 const BYTE *a = av;
33 const BYTE *b = bv;
34
35 while((len--) > 0) {
36 if(*a != *b) {
37 return *a - *b;
38 }
39 a++;
40 b++;
41 }
42 return 0;
43 }
44
45 int strlen(char *str)
46 {
47 int l = 0;
48 while(*str) {
49 l++;
50 str++;
51 }
52 return l;
53 }
Impressum, Datenschutz