<!-- Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013 The President and Fellows of Harvard College. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the University nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --> <html> <head> <title>__vprintf</title> <body bgcolor=#ffffff> <h2 align=center>__vprintf</h2> <h4 align=center>OS/161 Reference Manual</h4> <h3>Name</h3> <p> __vprintf - printf backend </p> <h3>Library</h3> <p> Standard C Library (libc, -lc) </p> <h3>Synopsis</h3> <p> <tt>#include <unistd.h></tt><br> <br> <tt>int</tt><br> <tt>__vprintf(void (*</tt><em>func</em><tt>)(void *</tt><em>clientdata</em><tt>, const char *</tt><em>str</em><tt>, size_t </tt><em>len</em><tt>), void *</tt><em>clientdata</em><tt>, const char *</tt><em>format</em><tt>, va_list)</tt> </p> <h3>Description</h3> <p> In OS/161, __vprintf is the back-end engine for <A HREF=printf.html>printf</A> and printf-like functions. Note that it is not portable - application code should use <A HREF=snprintf.html>snprintf or vsnprintf</A> when implementing their own printf-like functions. This documentation is provided for use when extending OS/161 itself. </p> <p> The <em>format</em> and subsequent arguments are treated as described under <A HREF=printf.html>printf</A>. </p> <p> The <em>func</em> argument is called to print text generated by the formatting process. The <em>clientdata</em> argument is passed straight through __vprintf to <em>func</em>. The <em>str</em> argument to func points to some text that is to be printed; the <em>len</em> argument is the length of that string, which should not be assumed to be null-terminated. </p> <p> The strings passed to <em>func</em> may be small; if printing is expensive buffering is probably wanted. </p> <h3>Return Values</h3> <p> __vprintf returns the number of characters printed. </p> </body> </html>