iPXE
stdio.h
Go to the documentation of this file.
1 #ifndef _STDIO_H
2 #define _STDIO_H
3 
4 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
5 
6 #include <stdint.h>
7 #include <stdarg.h>
8 
9 extern int putchar ( int character );
10 
11 extern int getchar ( void );
12 
13 extern int __attribute__ (( format ( printf, 1, 2 ) ))
14 printf ( const char *fmt, ... );
15 
16 extern int __attribute__ (( format ( printf, 3, 4 ) ))
17 snprintf ( char *buf, size_t size, const char *fmt, ... );
18 
19 extern int __attribute__ (( format ( printf, 2, 3 ) ))
20 asprintf ( char **strp, const char *fmt, ... );
21 
22 extern int vprintf ( const char *fmt, va_list args );
23 
24 extern int vsnprintf ( char *buf, size_t size, const char *fmt, va_list args );
25 
26 extern int vasprintf ( char **strp, const char *fmt, va_list args );
27 
28 /**
29  * Write a formatted string to a buffer
30  *
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
35  */
36 #define sprintf( buf, fmt, ... ) \
37  snprintf ( (buf), ~( ( size_t ) 0 ), (fmt), ## __VA_ARGS__ )
38 
39 /**
40  * Write a formatted string to a buffer
41  *
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
46  */
47 static inline int vsprintf ( char *buf, const char *fmt, va_list args ) {
48  return vsnprintf ( buf, ~( ( size_t ) 0 ), fmt, args );
49 }
50 
51 #endif /* _STDIO_H */
int printf(const char *fmt,...)
Write a formatted string to the console.
Definition: vsprintf.c:464
int int size_t const char int const char int vprintf(const char *fmt, va_list args)
Write a formatted string to the console.
Definition: vsprintf.c:449
static int vsprintf(char *buf, const char *fmt, va_list args)
Write a formatted string to a buffer.
Definition: stdio.h:47
A 16-bit general register.
Definition: registers.h:24
int getchar(void)
Read a single character from any console.
Definition: console.c:85
int vasprintf(char **strp, const char *fmt, va_list args)
Write a formatted string to newly allocated memory.
Definition: asprintf.c:17
int asprintf(char **strp, const char *fmt,...)
Write a formatted string to newly allocated memory.
Definition: asprintf.c:41
int vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
Write a formatted string to a buffer.
Definition: vsprintf.c:351
__builtin_va_list va_list
Definition: stdarg.h:6
int int size_t const char * fmt
Definition: stdio.h:17
int __attribute__((format(printf, 1, 2))) printf(const char *fmt
int int size_t size
Definition: stdio.h:17
int snprintf(char *buf, size_t size, const char *fmt,...)
Write a formatted string to a buffer.
Definition: vsprintf.c:382
int putchar(int character)
Write a single character to each console device.
Definition: console.c:28
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
int const char * format
Definition: xfer.h:104