mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-07-10 15:32:41 -07:00
Issue 20 patch (refactored code of the iso15693 implementation as well as several enhancements) [Adrian Dabrowski "atrox"]
This commit is contained in:
parent
6c1e2d95f4
commit
9455b51c2a
14 changed files with 1902 additions and 656 deletions
|
@ -69,3 +69,47 @@ char* strncat(char *dest, const char *src, unsigned int n)
|
|||
|
||||
return dest;
|
||||
}
|
||||
|
||||
char* strcat(char *dest, const char *src)
|
||||
{
|
||||
unsigned int dest_len = strlen(dest);
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0 ; src[i] != '\0' ; i++)
|
||||
dest[dest_len + i] = src[i];
|
||||
dest[dest_len + i] = '\0';
|
||||
|
||||
return dest;
|
||||
}
|
||||
////////////////////////////////////////// code to do 'itoa'
|
||||
|
||||
/* reverse: reverse string s in place */
|
||||
void strreverse(char s[])
|
||||
{
|
||||
int c, i, j;
|
||||
|
||||
for (i = 0, j = strlen(s)-1; i<j; i++, j--) {
|
||||
c = s[i];
|
||||
s[i] = s[j];
|
||||
s[j] = c;
|
||||
}
|
||||
}
|
||||
|
||||
/* itoa: convert n to characters in s */
|
||||
void itoa(int n, char s[])
|
||||
{
|
||||
int i, sign;
|
||||
|
||||
if ((sign = n) < 0) /* record sign */
|
||||
n = -n; /* make n positive */
|
||||
i = 0;
|
||||
do { /* generate digits in reverse order */
|
||||
s[i++] = n % 10 + '0'; /* get next digit */
|
||||
} while ((n /= 10) > 0); /* delete it */
|
||||
if (sign < 0)
|
||||
s[i++] = '-';
|
||||
s[i] = '\0';
|
||||
strreverse(s);
|
||||
}
|
||||
|
||||
//////////////////////////////////////// END 'itoa' CODE
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue