mirror of
https://github.com/ipxe/ipxe
synced 2025-12-20 03:55:46 +03:00
Allow vcprintf() to be called by external code such as the curses library.
Also trim another eight bytes from vsprintf.o. :)
This commit is contained in:
@@ -35,6 +35,35 @@
|
||||
|
||||
#define PRINTF_NO_LENGTH ( ( size_t ) -1 )
|
||||
|
||||
/**
|
||||
* A printf context
|
||||
*
|
||||
* Contexts are used in order to be able to share code between
|
||||
* vprintf() and vsnprintf(), without requiring the allocation of a
|
||||
* buffer for vprintf().
|
||||
*/
|
||||
struct printf_context {
|
||||
/**
|
||||
* Character handler
|
||||
*
|
||||
* @v ctx Context
|
||||
* @v c Character
|
||||
*
|
||||
* This method is called for each character written to the
|
||||
* formatted string.
|
||||
*/
|
||||
void ( * handler ) ( struct printf_context *ctx, unsigned int c );
|
||||
/** Length of formatted string
|
||||
*
|
||||
* When handler() is called, @len will be set to the number of
|
||||
* characters written so far (i.e. zero for the first call to
|
||||
* handler()).
|
||||
*/
|
||||
size_t len;
|
||||
};
|
||||
|
||||
extern size_t vcprintf ( struct printf_context *ctx, const char *fmt,
|
||||
va_list args );
|
||||
extern int vsnprintf ( char *buf, size_t size, const char *fmt, va_list args );
|
||||
extern int vprintf ( const char *fmt, va_list args );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user