@@ -15,7 +15,9 @@ out.each { |l| puts d(l) }
15
15
*/
16
16
17
17
#include <string.h>
18
+ #include <stdio.h>
18
19
#include <stdint.h>
20
+ #include <stdarg.h>
19
21
20
22
#define PROGMEM
21
23
@@ -99,3 +101,21 @@ inline int strncasecmp_PF(const char *s1, uint_farptr_t s2, size_t n) { return s
99
101
inline char * strstr_PF (const char * s1 , uint_farptr_t s2 ) { return (char * )strstr (s1 , (const char * )s2 ); }
100
102
inline int memcmp_PF (const void * s1 , uint_farptr_t s2 , size_t len ) { return memcmp (s1 , (const char * )s2 , len ); }
101
103
inline size_t strlen_P (const char * src ) { return strlen (src ); }
104
+
105
+ // These are normally defined by stdio.h on AVR, but we cannot override that
106
+ // include file (at least not without no longer being able to include the
107
+ // original as well), so just define these here. It seems likely that any
108
+ // sketch that uses these progmem-stdio functions will also include pgmspace.h
109
+ inline int vfprintf_P (FILE * stream , const char * __fmt , va_list __ap ) { return vfprintf (stream , __fmt , __ap ); }
110
+ inline int printf_P (const char * __fmt , ...) { va_list args ; va_start (args , __fmt ); return vprintf (__fmt , args ); va_end (args ); }
111
+ inline int sprintf_P (char * s , const char * __fmt , ...) { va_list args ; va_start (args , __fmt ); return sprintf (s , __fmt , args ); va_end (args ); }
112
+ inline int snprintf_P (char * s , size_t __n , const char * __fmt , ...) { va_list args ; va_start (args , __fmt ); return vsnprintf (s , __n , __fmt , args ); va_end (args ); }
113
+ inline int vsprintf_P (char * s , const char * __fmt , va_list ap ) { return vsprintf (s , __fmt , ap ); }
114
+ inline int vsnprintf_P (char * s , size_t __n , const char * __fmt , va_list ap ) { return vsnprintf (s , __n , __fmt , ap ); }
115
+ inline int fprintf_P (FILE * stream , const char * __fmt , ...) { va_list args ; va_start (args , __fmt ); return vfprintf (stream , __fmt , args ); va_end (args ); }
116
+ inline int fputs_P (const char * str , FILE * __stream ) { return fputs (str , __stream ); }
117
+ inline int puts_P (const char * str ) { return puts (str ); }
118
+ inline int vfscanf_P (FILE * stream , const char * __fmt , va_list __ap ) { return vfscanf (stream , __fmt , __ap ); }
119
+ inline int fscanf_P (FILE * stream , const char * __fmt , ...) { va_list args ; va_start (args , __fmt ); return vfscanf (stream , __fmt , args ); va_end (args ); }
120
+ inline int scanf_P (const char * __fmt , ...) { va_list args ; va_start (args , __fmt ); return vscanf (__fmt , args ); va_end (args ); }
121
+ inline int sscanf_P (const char * buf , const char * __fmt , ...) { va_list args ; va_start (args , __fmt ); return vsscanf (buf , __fmt , args ); va_end (args ); }
0 commit comments