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 FILE_SECBOOT ( PERMITTED );
6 
7 #include <stdint.h>
8 #include <stdarg.h>
9 
10 extern int putchar ( int character );
11 
12 extern int getchar ( void );
13 
14 extern int __attribute__ (( format ( printf, 1, 2 ) ))
15 printf ( const char *fmt, ... );
16 
17 extern int __attribute__ (( format ( printf, 3, 4 ) ))
18 snprintf ( char *buf, size_t size, const char *fmt, ... );
19 
20 extern int __attribute__ (( format ( printf, 2, 3 ) ))
21 asprintf ( char **strp, const char *fmt, ... );
22 
23 extern int vprintf ( const char *fmt, va_list args );
24 
25 extern int vsnprintf ( char *buf, size_t size, const char *fmt, va_list args );
26 
27 extern int vasprintf ( char **strp, const char *fmt, va_list args );
28 
29 /**
30  * Write a formatted string to a buffer
31  *
32  * @v buf Buffer into which to write the string
33  * @v fmt Format string
34  * @v ... Arguments corresponding to the format string
35  * @ret len Length of formatted string
36  */
37 #define sprintf( buf, fmt, ... ) \
38  snprintf ( (buf), ~( ( size_t ) 0 ), (fmt), ## __VA_ARGS__ )
39 
40 /**
41  * Write a formatted string to a buffer
42  *
43  * @v buf Buffer into which to write the string
44  * @v fmt Format string
45  * @v args Arguments corresponding to the format string
46  * @ret len Length of formatted string
47  */
48 static inline int vsprintf ( char *buf, const char *fmt, va_list args ) {
49  return vsnprintf ( buf, ~( ( size_t ) 0 ), fmt, args );
50 }
51 
52 #endif /* _STDIO_H */
int printf(const char *fmt,...)
Write a formatted string to the console.
Definition: vsprintf.c:465
FILE_SECBOOT(PERMITTED)
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:450
static int vsprintf(char *buf, const char *fmt, va_list args)
Write a formatted string to a buffer.
Definition: stdio.h:48
A 16-bit general register.
Definition: registers.h:24
int getchar(void)
Read a single character from any console.
Definition: console.c:86
int vasprintf(char **strp, const char *fmt, va_list args)
Write a formatted string to newly allocated memory.
Definition: asprintf.c:18
int asprintf(char **strp, const char *fmt,...)
Write a formatted string to newly allocated memory.
Definition: asprintf.c:42
int vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
Write a formatted string to a buffer.
Definition: vsprintf.c:352
__builtin_va_list va_list
Definition: stdarg.h:7
int int size_t const char * fmt
Definition: stdio.h:18
int __attribute__((format(printf, 1, 2))) printf(const char *fmt
int int size_t size
Definition: stdio.h:18
int snprintf(char *buf, size_t size, const char *fmt,...)
Write a formatted string to a buffer.
Definition: vsprintf.c:383
int putchar(int character)
Write a single character to each console device.
Definition: console.c:29
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
int const char * format
Definition: xfer.h:105