__vprintf

OS/161 Reference Manual

Name

__vprintf - printf backend

Library

Standard C Library (libc, -lc)

Synopsis

#include <unistd.h>

int
__vprintf(void (*func)(void *clientdata, const char *str, size_t len), void *clientdata, const char *format, va_list)

Description

In OS/161, __vprintf is the back-end engine for printf and printf-like functions. Note that it is not portable - application code should use snprintf or vsnprintf when implementing their own printf-like functions. This documentation is provided for use when extending OS/161 itself.

The format and subsequent arguments are treated as described under printf.

The func argument is called to print text generated by the formatting process. The clientdata argument is passed straight through __vprintf to func. The str argument to func points to some text that is to be printed; the len argument is the length of that string, which should not be assumed to be null-terminated.

The strings passed to func may be small; if printing is expensive buffering is probably wanted.

Return Values

__vprintf returns the number of characters printed.