xprintf d727b10
impl/xprintf-core.h File Reference

xvprintf_protected() formats according to ISO-C printf() specs and prints the result to an abstract channel. More...

Data Structures

struct  xprintf_protectedChannel
 Information for the routine that writes the output of xprintf(). More...

Functions

int xvprintf_protected (struct xprintf_protectedChannel *xprch, const char *format, va_list ap)
 Prints to a protected channel, analogous to vfprintf().

Detailed Description

xvprintf_protected() formats according to ISO-C printf() specs and prints the result to an abstract channel.

The abstract channel approach allows printing to any output medium. The caller must ensure that the channel is protected so that concurrent invocations of xvprintf_protected() will not disturb each other.


Function Documentation

int xvprintf_protected ( struct xprintf_protectedChannel xprch,
const char *  format,
va_list  ap 
)

Prints to a protected channel, analogous to vfprintf().

xvprintf_protected() will call xprch's xprintf_protectedChannel.writeProtected() as often as necessary.

See also:
vfprintf() and fprintf() specifications in ISO C99
Parameters:
xprchthe protected channel
formatthe vfprintf() compatible format argument
apthe vfprintf() compatible va_list argument
Returns:
<0: error code
≥0: count of chars printed (sum of values returned by calls to xprintf_protectedChannel.writeProtected())