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