// // Created by MightyPork on 2017/11/09. // // Small sprintf/snprintf implementation, used instead of the newlib one. // #ifndef GEX_SNPRINTF_H #define GEX_SNPRINTF_H #include #include int fixup_vsnprintf(char *str, size_t count, const char *fmt, va_list args); int fixup_snprintf(char *str, size_t count,const char *fmt,...); int fixup_vasprintf(char **ptr, const char *format, va_list ap); int fixup_asprintf(char **ptr, const char *format, ...); int fixup_sprintf(char *ptr, const char *format, ...); int fixup_printf(const char *format, ...); int fixup_vprintf(const char *format, va_list ap); #define VSNPRINTF(...) fixup_vsnprintf(__VA_ARGS__) #define SNPRINTF(...) fixup_snprintf(__VA_ARGS__) #define VASPRINTF(...) fixup_vasprintf(__VA_ARGS__) #define ASPRINTF(...) fixup_asprintf(__VA_ARGS__) #define SPRINTF(...) fixup_sprintf(__VA_ARGS__) #define PRINTF(...) fixup_printf(__VA_ARGS__) #define VPRINTF(...) fixup_vprintf(__VA_ARGS__) // for debug //#include //#define PRINTF(...) printf(__VA_ARGS__) //#define SPRINTF(...) sprintf(__VA_ARGS__) // extern extern void stdout_puts(const char *s); extern void stdout_putchar(char c); extern void stdout_write(const char *s, size_t len); #define PUTS(s) stdout_puts((s)) #define PUTCHAR(c) stdout_putchar((c)) #define WRITE(s, n) stdout_write((s), (n)) #endif //GEX_SNPRINTF_H