|
@@ -33,8 +33,7 @@
|
33
|
33
|
|
34
|
34
|
#include <stdint.h>
|
35
|
35
|
#include <stdarg.h>
|
36
|
|
-
|
37
|
|
-#define PRINTF_NO_LENGTH ( ( size_t ) -1 )
|
|
36
|
+#include <stdio.h>
|
38
|
37
|
|
39
|
38
|
/**
|
40
|
39
|
* A printf context
|
|
@@ -65,36 +64,4 @@ struct printf_context {
|
65
|
64
|
|
66
|
65
|
extern size_t vcprintf ( struct printf_context *ctx, const char *fmt,
|
67
|
66
|
va_list args );
|
68
|
|
-extern int vsnprintf ( char *buf, size_t size, const char *fmt, va_list args );
|
69
|
|
-extern int vprintf ( const char *fmt, va_list args );
|
70
|
|
-
|
71
|
|
-extern int __attribute__ (( format ( printf, 3, 4 ) ))
|
72
|
|
-snprintf ( char *buf, size_t size, const char *fmt, ... );
|
73
|
|
-
|
74
|
|
-extern int __attribute__ (( format ( printf, 1, 2 ) ))
|
75
|
|
-printf ( const char *fmt, ... );
|
76
|
|
-
|
77
|
|
-/**
|
78
|
|
- * Write a formatted string to a buffer
|
79
|
|
- *
|
80
|
|
- * @v buf Buffer into which to write the string
|
81
|
|
- * @v fmt Format string
|
82
|
|
- * @v ... Arguments corresponding to the format string
|
83
|
|
- * @ret len Length of formatted string
|
84
|
|
- */
|
85
|
|
-#define sprintf( buf, fmt, ... ) \
|
86
|
|
- snprintf ( (buf), PRINTF_NO_LENGTH, (fmt), ## __VA_ARGS__ )
|
87
|
|
-
|
88
|
|
-/**
|
89
|
|
- * Write a formatted string to a buffer
|
90
|
|
- *
|
91
|
|
- * @v buf Buffer into which to write the string
|
92
|
|
- * @v fmt Format string
|
93
|
|
- * @v args Arguments corresponding to the format string
|
94
|
|
- * @ret len Length of formatted string
|
95
|
|
- */
|
96
|
|
-static inline int vsprintf ( char *buf, const char *fmt, va_list args ) {
|
97
|
|
- return vsnprintf ( buf, PRINTF_NO_LENGTH, fmt, args );
|
98
|
|
-}
|
99
|
|
-
|
100
|
67
|
#endif /* VSPRINTF_H */
|