Corrected sprintf() prototype & behaviour.

This commit is contained in:
Johny Mattsson 2016-01-27 19:32:10 +11:00
parent 74d27b3486
commit 9fd215b028
2 changed files with 5 additions and 3 deletions

View File

@ -1094,12 +1094,14 @@ exponent(char *p, int exp, int fmtch)
#endif /* FLOATINGPT */ #endif /* FLOATINGPT */
void c_sprintf(char *s, char *fmt, ...) int c_sprintf(char *s, const char *fmt, ...)
{ {
int n;
va_list arg; va_list arg;
va_start(arg, fmt); va_start(arg, fmt);
vsprintf(s, fmt, arg); n = vsprintf(s, fmt, arg);
va_end(arg); va_end(arg);
return n;
} }
#endif #endif

View File

@ -60,7 +60,7 @@ extern void output_redirect(const char *str);
#define c_sprintf os_sprintf #define c_sprintf os_sprintf
#else #else
#include "c_stdarg.h" #include "c_stdarg.h"
void c_sprintf(char* s,char *fmt, ...); int c_sprintf(char* s,const char *fmt, ...);
#endif #endif
// #define c_vsprintf ets_vsprintf // #define c_vsprintf ets_vsprintf