]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - armsrc/printf.c
changes to mifare plus code (#706)
[proxmark3-svn] / armsrc / printf.c
index 6060870dc3587cb5b2a6faf9ee8c98128229a991..79c123dff624e6c030df9307b16b72d38e7631f6 100644 (file)
  *     @(#)subr_prf.c  8.3 (Berkeley) 1/21/94
  */
 
-typedef unsigned long size_t;
-typedef long ssize_t;
-#ifdef __64BIT__
-typedef unsigned long long uintmax_t;
-typedef long long intmax_t;
-#else
-typedef unsigned int uintmax_t;
-typedef int intmax_t;
-#endif
+#include <stddef.h>
+#include <stdarg.h>
+#include "printf.h"
+#include "util.h"
+#include "string.h"
+
 typedef unsigned char u_char;
 typedef unsigned int u_int;
 typedef unsigned long u_long;
 typedef unsigned short u_short;
 typedef unsigned long long u_quad_t;
 typedef long long quad_t;
-typedef unsigned long uintptr_t;
-typedef long ptrdiff_t;
-#define NULL ((void*)0)
+
+typedef int ssize_t;
+
 #define NBBY    8               /* number of bits in a byte */
+
 char const hex2ascii_data[] = "0123456789abcdefghijklmnopqrstuvwxyz";
 #define hex2ascii(hex)  (hex2ascii_data[hex])
-#define va_list __builtin_va_list
-#define va_start __builtin_va_start
-#define va_arg __builtin_va_arg
-#define va_end __builtin_va_end
 #define toupper(c)      ((c) - 0x20 * (((c) >= 'a') && ((c) <= 'z')))
-static size_t
-strlen(const char *s)
-{
-       size_t l = 0;
-       while (*s++)
-               l++;
-       return l;
-}
 
 /* Max number conversion buffer length: a u_quad_t in base 2, plus NUL byte. */
 #define MAXNBUF        (sizeof(intmax_t) * NBBY + 1)
@@ -189,6 +175,7 @@ reswitch:   switch (ch = (u_char)*fmt++) {
                                padc = '0';
                                goto reswitch;
                        }
+                       // intentionally fall through to next case
                case '1': case '2': case '3': case '4':
                case '5': case '6': case '7': case '8': case '9':
                                for (n = 0;; ++fmt) {
@@ -431,6 +418,11 @@ number:
 #undef PCHAR
 }
 
+int vsprintf(char *dest, const char *fmt, va_list ap)
+{
+       return kvsprintf(fmt, dest, 10, ap);
+}
+
 int
 sprintf(char *dest, const char *fmt, ...)
 {
Impressum, Datenschutz