iPXE
stdio.h
Go to the documentation of this file.
1#ifndef _STDIO_H
2#define _STDIO_H
3
4FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
5FILE_SECBOOT ( PERMITTED );
6
7#include <stdint.h>
8#include <stdarg.h>
9
10extern int putchar ( int character );
11
12extern int getchar ( void );
13
14extern int __attribute__ (( format ( printf, 1, 2 ) ))
15printf ( const char *fmt, ... );
16
17extern int __attribute__ (( format ( printf, 3, 4 ) ))
18snprintf ( char *buf, size_t size, const char *fmt, ... );
19
20extern int __attribute__ (( format ( printf, 2, 3 ) ))
21asprintf ( char **strp, const char *fmt, ... );
22
23extern int vprintf ( const char *fmt, va_list args );
24
25extern int vsnprintf ( char *buf, size_t size, const char *fmt, va_list args );
26
27extern 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 */
48static 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 asprintf(char **strp, const char *fmt,...)
Write a formatted string to newly allocated memory.
Definition asprintf.c:42
int vasprintf(char **strp, const char *fmt, va_list args)
Write a formatted string to newly allocated memory.
Definition asprintf.c:18
uint16_t size
Buffer size.
Definition dwmac.h:3
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
Definition compiler.h:926
#define __attribute__(x)
Definition compiler.h:10
__builtin_va_list va_list
Definition stdarg.h:7
int getchar(void)
Read a single character from any console.
Definition console.c:86
static int vsprintf(char *buf, const char *fmt, va_list args)
Write a formatted string to a buffer.
Definition stdio.h:48
int vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
Write a formatted string to a buffer.
Definition vsprintf.c:352
int putchar(int character)
Write a single character to each console device.
Definition console.c:29
int printf(const char *fmt,...)
Write a formatted string to the console.
Definition vsprintf.c:465
int vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
Write a formatted string to a buffer.
Definition vsprintf.c:352
int vprintf(const char *fmt, va_list args)
Write a formatted string to the console.
Definition vsprintf.c:450
int snprintf(char *buf, size_t size, const char *fmt,...)
Write a formatted string to a buffer.
Definition vsprintf.c:383
int ssize_t const char * fmt
Definition vsprintf.h:73
int const char * format
Definition xfer.h:105