4 FILE_LICENCE ( GPL2_OR_LATER );
9 extern void putchar ( int character );
11 extern int getchar ( void );
13 extern int __attribute__ (( format ( printf, 1, 2 ) ))
14 printf ( const char *fmt, ... );
16 extern int __attribute__ (( format ( printf, 3, 4 ) ))
17 snprintf ( char *buf, size_t size, const char *fmt, ... );
19 extern int __attribute__ (( format ( printf, 2, 3 ) ))
20 asprintf ( char **strp, const char *fmt, ... );
22 extern int vprintf ( const char *fmt, va_list args );
24 extern int vsnprintf ( char *buf, size_t size, const char *fmt, va_list args );
26 extern int vasprintf ( char **strp, const char *fmt, va_list args );
29 * Write a formatted string to a buffer
31 * @v buf Buffer into which to write the string
32 * @v fmt Format string
33 * @v ... Arguments corresponding to the format string
34 * @ret len Length of formatted string
36 #define sprintf( buf, fmt, ... ) \
37 snprintf ( (buf), ~( ( size_t ) 0 ), (fmt), ## __VA_ARGS__ )
40 * Write a formatted string to a buffer
42 * @v buf Buffer into which to write the string
43 * @v fmt Format string
44 * @v args Arguments corresponding to the format string
45 * @ret len Length of formatted string
47 static inline int vsprintf ( char *buf, const char *fmt, va_list args ) {
48 return vsnprintf ( buf, ~( ( size_t ) 0 ), fmt, args );