[sundance] Add reset completion check
[gpxe.git] / src / include / stdio.h
blob82077e20f062c86d54129be6cd720ef28911bc52
1 #ifndef _STDIO_H
2 #define _STDIO_H
4 #include <stdint.h>
5 #include <stdarg.h>
7 extern int __attribute__ (( format ( printf, 1, 2 ) ))
8 printf ( const char *fmt, ... );
10 extern int __attribute__ (( format ( printf, 3, 4 ) ))
11 snprintf ( char *buf, size_t size, const char *fmt, ... );
13 extern int __attribute__ (( format ( printf, 2, 3 ) ))
14 asprintf ( char **strp, const char *fmt, ... );
16 extern int vprintf ( const char *fmt, va_list args );
18 extern int vsnprintf ( char *buf, size_t size, const char *fmt, va_list args );
20 extern int vasprintf ( char **strp, const char *fmt, va_list args );
22 /**
23 * Write a formatted string to a buffer
25 * @v buf Buffer into which to write the string
26 * @v fmt Format string
27 * @v ... Arguments corresponding to the format string
28 * @ret len Length of formatted string
30 #define sprintf( buf, fmt, ... ) \
31 snprintf ( (buf), ~( ( size_t ) 0 ), (fmt), ## __VA_ARGS__ )
33 /**
34 * Write a formatted string to a buffer
36 * @v buf Buffer into which to write the string
37 * @v fmt Format string
38 * @v args Arguments corresponding to the format string
39 * @ret len Length of formatted string
41 static inline int vsprintf ( char *buf, const char *fmt, va_list args ) {
42 return vsnprintf ( buf, ~( ( size_t ) 0 ), fmt, args );
45 #endif /* _STDIO_H */