]> git.zerfleddert.de Git - proxmark3-svn/commitdiff
Split str* and mem* into string.[ch]
authormarcansoft <marcansoft@ef4ab9da-24cd-11de-8aaa-f3a34680c41f>
Sun, 21 Feb 2010 00:10:28 +0000 (00:10 +0000)
committermarcansoft <marcansoft@ef4ab9da-24cd-11de-8aaa-f3a34680c41f>
Sun, 21 Feb 2010 00:10:28 +0000 (00:10 +0000)
15 files changed:
armsrc/Makefile
armsrc/appmain.c
armsrc/fpgaloader.c
armsrc/hitag2.c
armsrc/iso14443.c
armsrc/iso14443a.c
armsrc/iso15693.c
armsrc/legicrf.c
armsrc/lfops.c
armsrc/printf.c
armsrc/printf.h
armsrc/string.c [new file with mode: 0644]
armsrc/string.h [new file with mode: 0644]
armsrc/util.c
armsrc/util.h

index 0aa4ea6b7295255eb5ceda041290bf822378b2d1..967bf0975cf8b1c60681f371634f9dea93174796 100644 (file)
@@ -19,6 +19,7 @@ THUMBSRC = start.c \
        $(SRC_LF) \
        appmain.c printf.c \
        util.c \
+       string.c \
        usb.c
 
 # These are to be compiled in ARM mode
index c2ea9f7d9bbc62001aeb9d2a5750fb683eddfb87..62f13fd4bcbeb4a9fa7daa2671d94ee86104d5b9 100644 (file)
@@ -8,6 +8,10 @@
 #include "proxmark3.h"
 #include "apps.h"
 #include "util.h"
+#include "printf.h"
+#include "string.h"
+
+#include <stdarg.h>
 
 #include "legicrf.h"
 
 # include "LCD.h"
 #endif
 
-#define va_list __builtin_va_list
-#define va_start __builtin_va_start
-#define va_arg __builtin_va_arg
-#define va_end __builtin_va_end
-int kvsprintf(char const *fmt, void *arg, int radix, va_list ap);
-
-
 #define abs(x) ( ((x)<0) ? -(x) : (x) )
 
 //=============================================================================
index c093c73cf69595ff6dd755c899dd713c2376933e..50a6521dcd9fda0302c073bfe1fea0704668b0a7 100644 (file)
@@ -7,6 +7,7 @@
 #include "proxmark3.h"
 #include "apps.h"
 #include "util.h"
+#include "string.h"
 
 //-----------------------------------------------------------------------------
 // Set up the Serial Peripheral Interface as master
index 1278b758d5d1b9f24f4ac5cd35c308ba4863fa29..875eba2a35baa6e767f22fcc07ef44bbf1b8af36 100644 (file)
@@ -10,8 +10,8 @@
 #include "proxmark3.h"
 #include "apps.h"
 #include "util.h"
-
 #include "hitag2.h"
+#include "string.h"
 
 struct hitag2_cipher_state {
        uint64_t state;
index 0e446abe7f8d98c1d70fa309f77956407aaf6464..f50d7cb9737aa3127236710ddbf6cb1b0361b448 100644 (file)
@@ -7,6 +7,7 @@
 #include "proxmark3.h"
 #include "apps.h"
 #include "util.h"
+#include "string.h"
 
 #include "iso14443crc.h"
 
index 409bd3d6cec787c29410fe9d6766177484cbcbf7..e60f3198cb18172747ff5e716a52c53b54cc51ac 100644 (file)
@@ -6,6 +6,8 @@
 #include "proxmark3.h"
 #include "apps.h"
 #include "util.h"
+#include "string.h"
+
 #include "iso14443crc.h"
 
 static uint8_t *trace = (uint8_t *) BigBuf;
index 30a631e80e859eb3616b5d816519e686901dd53f..31c13e95e08330f4bb9841ab0ee7abd61679d0f3 100644 (file)
@@ -11,6 +11,7 @@
 #include "proxmark3.h"
 #include "util.h"
 #include "apps.h"
+#include "string.h"
 
 // FROM winsrc\prox.h //////////////////////////////////
 #define arraylen(x) (sizeof(x)/sizeof((x)[0]))
index eb38939d5a82f380567246af23e8b3abcd3c7d0e..b3ac89bd020c17efc2bc38bc19c320c0e80d9b10 100644 (file)
@@ -7,6 +7,7 @@
 #include "proxmark3.h"
 #include "apps.h"
 #include "util.h"
+#include "string.h"
 
 #include "legicrf.h"
 #include "legic_prng.h"
index 93c0cbde3bd1b7fb1c697db968fe9014db3fb683..dcc9e54dadd2801af053d0267dcc8b08c891fffd 100644 (file)
@@ -9,6 +9,7 @@
 #include "util.h"
 #include "hitag2.h"
 #include "crc16.h"
+#include "string.h"
 
 void AcquireRawAdcSamples125k(int at134khz)
 {
index 49537c6412e092a8f7cbb29091860f21d53b9c20..d5e61798a3516f82ee932922f8b63e1a81139ef2 100644 (file)
@@ -38,6 +38,7 @@
 #include <stdarg.h>
 #include "printf.h"
 #include "util.h"
+#include "string.h"
 
 typedef uint32_t uintmax_t;
 typedef int32_t intmax_t;
index 5c2ade8c550c39520359c3fb1448744234df5bb1..b1d613c10feae7441dddd59b72aa48ad56cd6239 100644 (file)
@@ -7,6 +7,4 @@ int kvsprintf(const char *format, void *arg, int radix, va_list ap) __attribute_
 int vsprintf(char *str, const char *format, va_list ap) __attribute__ ((format (printf, 2, 0)));
 int sprintf(char *str, const char *format, ...) __attribute__ ((format (printf, 2, 3)));
 
-
-
 #endif
\ No newline at end of file
diff --git a/armsrc/string.c b/armsrc/string.c
new file mode 100644 (file)
index 0000000..a3d3c04
--- /dev/null
@@ -0,0 +1,62 @@
+/* Implementations of the common string.h functions */
+#include "string.h"
+#include <stdint.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;
+}
diff --git a/armsrc/string.h b/armsrc/string.h
new file mode 100644 (file)
index 0000000..0a68329
--- /dev/null
@@ -0,0 +1,10 @@
+#ifndef __STRING_H
+#define __STRING_H
+
+int strlen(const char *str);
+void *memcpy(void *dest, const void *src, int len);
+void *memset(void *dest, int c, int len);
+int memcmp(const void *av, const void *bv, int len);
+char *strncat(char *dest, const char *src, unsigned int n);
+
+#endif /* __STRING_H */
\ No newline at end of file
index ae6408cfe7032d638e94cbd67ec8af99ca781e1b..7a2895cfc28a4c944fb16f81ab21df95459a724a 100644 (file)
@@ -4,65 +4,7 @@
 //-----------------------------------------------------------------------------
 #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)
 {
index 621f3fe533da2da316ec659e5d704e9f1ff7f147..0af673cc14eacd6b1531eb01917e7cc2c32d3c97 100644 (file)
 #define BUTTON_SINGLE_CLICK -1
 #define BUTTON_DOUBLE_CLICK -2
 #define BUTTON_ERROR -99
-int strlen(const char *str);
-void *memcpy(void *dest, const void *src, int len);
-void *memset(void *dest, int c, int len);
-int memcmp(const void *av, const void *bv, int len);
-char *strncat(char *dest, const char *src, unsigned int n);
+
 void num_to_bytes(uint64_t n, size_t len, uint8_t* dest);
 uint64_t bytes_to_num(uint8_t* src, size_t len);
 
Impressum, Datenschutz