|
|
|
@ -12,9 +12,27 @@
@@ -12,9 +12,27 @@
|
|
|
|
|
|
|
|
|
|
extern const AP_HAL::HAL& hal; |
|
|
|
|
|
|
|
|
|
static int libc_vsnprintf(char* str, size_t size, const char *format, va_list ap)
|
|
|
|
|
/*
|
|
|
|
|
implement vsnprintf with support for %S meaning a progmem string |
|
|
|
|
*/ |
|
|
|
|
static int libc_vsnprintf(char* str, size_t size, const char *fmt, va_list ap)
|
|
|
|
|
{ |
|
|
|
|
return vsnprintf(str, size, format, ap); |
|
|
|
|
int i, ret; |
|
|
|
|
char *fmt2 = (char *)fmt; |
|
|
|
|
if (strstr(fmt2, "%S") != NULL) { |
|
|
|
|
fmt2 = strdup(fmt); |
|
|
|
|
for (i=0; fmt2[i]; i++) { |
|
|
|
|
// cope with %S
|
|
|
|
|
if (fmt2[i] == '%' && fmt2[i+1] == 'S') { |
|
|
|
|
fmt2[i+1] = 's'; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
ret = vsnprintf(str, size, fmt2, ap); |
|
|
|
|
if (fmt2 != fmt) { |
|
|
|
|
free(fmt2); |
|
|
|
|
} |
|
|
|
|
return ret; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#include "Util.h" |
|
|
|
|