4 FILE_LICENCE ( GPL2_OR_LATER
);
9 extern int __attribute__ (( format ( printf
, 1, 2 ) ))
10 printf ( const char *fmt
, ... );
12 extern int __attribute__ (( format ( printf
, 3, 4 ) ))
13 snprintf ( char *buf
, size_t size
, const char *fmt
, ... );
15 extern int __attribute__ (( format ( printf
, 2, 3 ) ))
16 asprintf ( char **strp
, const char *fmt
, ... );
18 extern int vprintf ( const char *fmt
, va_list args
);
20 extern int vsnprintf ( char *buf
, size_t size
, const char *fmt
, va_list args
);
22 extern int vasprintf ( char **strp
, const char *fmt
, va_list args
);
25 * Write a formatted string to a buffer
27 * @v buf Buffer into which to write the string
28 * @v fmt Format string
29 * @v ... Arguments corresponding to the format string
30 * @ret len Length of formatted string
32 #define sprintf( buf, fmt, ... ) \
33 snprintf ( (buf), ~( ( size_t ) 0 ), (fmt), ## __VA_ARGS__ )
36 * Write a formatted string to a buffer
38 * @v buf Buffer into which to write the string
39 * @v fmt Format string
40 * @v args Arguments corresponding to the format string
41 * @ret len Length of formatted string
43 static inline int vsprintf ( char *buf
, const char *fmt
, va_list args
) {
44 return vsnprintf ( buf
, ~( ( size_t ) 0 ), fmt
, args
);