2002-07-04 Jeff Johnston <jjohnstn@redhat.com>

* libc/stdio/Makefile.am: Add asprintf.c and vasprintf.c.
        * libc/stdio/Makefile.in: Regenerated.
        * libc/stdio/asprintf.c: New file.
        * libc/stdio/vasprintf.c: Ditto.
        * libc/stdio/fvwrite.c: Add code to dynamically reallocate
        the buffer for asprintf support.
        * libc/stdio/sprintf.c: Add asprintf documentation.
        * libc/stdio/vfprintf.c: Add vasprintf documentation.
        * libc/include/stdio.h: Add new prototypes.
This commit is contained in:
Jeff Johnston 2002-07-04 18:56:17 +00:00
parent 5cff62d656
commit 7501704dc9
9 changed files with 284 additions and 52 deletions

View File

@ -1,3 +1,15 @@
2002-07-04 Jeff Johnston <jjohnstn@redhat.com>
* libc/stdio/Makefile.am: Add asprintf.c and vasprintf.c.
* libc/stdio/Makefile.in: Regenerated.
* libc/stdio/asprintf.c: New file.
* libc/stdio/vasprintf.c: Ditto.
* libc/stdio/fvwrite.c: Add code to dynamically reallocate
the buffer for asprintf support.
* libc/stdio/sprintf.c: Add asprintf documentation.
* libc/stdio/vfprintf.c: Add vasprintf documentation.
* libc/include/stdio.h: Add new prototypes.
2002-07-02 Thomas Fitzsimmons <fitzsim@redhat.com>
* libc/search/hcreate.c: Remove advertising clause from license.

View File

@ -198,11 +198,13 @@ int _EXFUN(remove, (const char *));
int _EXFUN(rename, (const char *, const char *));
#endif
#ifndef __STRICT_ANSI__
int _EXFUN(asprintf, (char **, const char *, ...));
int _EXFUN(vfiprintf, (FILE *, const char *, __VALIST));
int _EXFUN(iprintf, (const char *, ...));
int _EXFUN(fiprintf, (FILE *, const char *, ...));
int _EXFUN(siprintf, (char *, const char *, ...));
char * _EXFUN(tempnam, (const char *, const char *));
int _EXFUN(vasprintf, (char **, const char *, __VALIST));
int _EXFUN(vsnprintf, (char *, size_t, const char *, __VALIST));
int _EXFUN(vfscanf, (FILE *, const char *, __VALIST));
int _EXFUN(vscanf, (const char *, __VALIST));
@ -240,6 +242,7 @@ int _EXFUN(putchar_unlocked, (int));
* Recursive versions of the above.
*/
int _EXFUN(_asprintf_r, (struct _reent *, char **, const char *, ...));
FILE * _EXFUN(_fdopen_r, (struct _reent *, int, const char *));
FILE * _EXFUN(_fopen_r, (struct _reent *, const char *, const char *));
int _EXFUN(_fscanf_r, (struct _reent *, FILE *, const char *, ...));
@ -262,6 +265,7 @@ int _EXFUN(_sscanf_r, (struct _reent *, const char *, const char *, ...));
char * _EXFUN(_tempnam_r, (struct _reent *, const char *, const char *));
FILE * _EXFUN(_tmpfile_r, (struct _reent *));
char * _EXFUN(_tmpnam_r, (struct _reent *, char *));
int _EXFUN(_vasprintf_r, (struct _reent *, char **, const char *, __VALIST));
int _EXFUN(_vfprintf_r, (struct _reent *, FILE *, const char *, __VALIST));
int _EXFUN(_vprintf_r, (struct _reent *, const char *, __VALIST));
int _EXFUN(_vsprintf_r, (struct _reent *, char *, const char *, __VALIST));

View File

@ -5,6 +5,7 @@ AUTOMAKE_OPTIONS = cygnus
INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
LIB_SOURCES = \
asprintf.c \
clearerr.c \
fclose.c \
fdopen.c \
@ -68,6 +69,7 @@ LIB_SOURCES = \
tmpfile.c \
tmpnam.c \
ungetc.c \
vasprintf.c \
vfscanf.c \
vprintf.c \
vscanf.c \

View File

@ -109,6 +109,7 @@ AUTOMAKE_OPTIONS = cygnus
INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
LIB_SOURCES = \
asprintf.c \
clearerr.c \
fclose.c \
fdopen.c \
@ -172,6 +173,7 @@ LIB_SOURCES = \
tmpfile.c \
tmpnam.c \
ungetc.c \
vasprintf.c \
vfscanf.c \
vprintf.c \
vscanf.c \
@ -268,16 +270,17 @@ CPPFLAGS = @CPPFLAGS@
LIBS = @LIBS@
@USE_LIBTOOL_FALSE@lib_a_DEPENDENCIES = vfiprintf.$(oext) \
@USE_LIBTOOL_FALSE@vfprintf.$(oext)
@USE_LIBTOOL_FALSE@lib_a_OBJECTS = clearerr.$(OBJEXT) fclose.$(OBJEXT) \
@USE_LIBTOOL_FALSE@fdopen.$(OBJEXT) feof.$(OBJEXT) ferror.$(OBJEXT) \
@USE_LIBTOOL_FALSE@fflush.$(OBJEXT) fgetc.$(OBJEXT) fgetpos.$(OBJEXT) \
@USE_LIBTOOL_FALSE@fgets.$(OBJEXT) fileno.$(OBJEXT) findfp.$(OBJEXT) \
@USE_LIBTOOL_FALSE@fiprintf.$(OBJEXT) flags.$(OBJEXT) fopen.$(OBJEXT) \
@USE_LIBTOOL_FALSE@fprintf.$(OBJEXT) fputc.$(OBJEXT) fputs.$(OBJEXT) \
@USE_LIBTOOL_FALSE@fread.$(OBJEXT) freopen.$(OBJEXT) fscanf.$(OBJEXT) \
@USE_LIBTOOL_FALSE@fseek.$(OBJEXT) fsetpos.$(OBJEXT) ftell.$(OBJEXT) \
@USE_LIBTOOL_FALSE@fvwrite.$(OBJEXT) fwalk.$(OBJEXT) fwrite.$(OBJEXT) \
@USE_LIBTOOL_FALSE@getc.$(OBJEXT) getchar.$(OBJEXT) getc_u.$(OBJEXT) \
@USE_LIBTOOL_FALSE@lib_a_OBJECTS = asprintf.$(OBJEXT) \
@USE_LIBTOOL_FALSE@clearerr.$(OBJEXT) fclose.$(OBJEXT) fdopen.$(OBJEXT) \
@USE_LIBTOOL_FALSE@feof.$(OBJEXT) ferror.$(OBJEXT) fflush.$(OBJEXT) \
@USE_LIBTOOL_FALSE@fgetc.$(OBJEXT) fgetpos.$(OBJEXT) fgets.$(OBJEXT) \
@USE_LIBTOOL_FALSE@fileno.$(OBJEXT) findfp.$(OBJEXT) fiprintf.$(OBJEXT) \
@USE_LIBTOOL_FALSE@flags.$(OBJEXT) fopen.$(OBJEXT) fprintf.$(OBJEXT) \
@USE_LIBTOOL_FALSE@fputc.$(OBJEXT) fputs.$(OBJEXT) fread.$(OBJEXT) \
@USE_LIBTOOL_FALSE@freopen.$(OBJEXT) fscanf.$(OBJEXT) fseek.$(OBJEXT) \
@USE_LIBTOOL_FALSE@fsetpos.$(OBJEXT) ftell.$(OBJEXT) fvwrite.$(OBJEXT) \
@USE_LIBTOOL_FALSE@fwalk.$(OBJEXT) fwrite.$(OBJEXT) getc.$(OBJEXT) \
@USE_LIBTOOL_FALSE@getchar.$(OBJEXT) getc_u.$(OBJEXT) \
@USE_LIBTOOL_FALSE@getchar_u.$(OBJEXT) getdelim.$(OBJEXT) \
@USE_LIBTOOL_FALSE@getline.$(OBJEXT) gets.$(OBJEXT) getw.$(OBJEXT) \
@USE_LIBTOOL_FALSE@iprintf.$(OBJEXT) makebuf.$(OBJEXT) mktemp.$(OBJEXT) \
@ -291,28 +294,30 @@ LIBS = @LIBS@
@USE_LIBTOOL_FALSE@siprintf.$(OBJEXT) snprintf.$(OBJEXT) \
@USE_LIBTOOL_FALSE@sprintf.$(OBJEXT) sscanf.$(OBJEXT) stdio.$(OBJEXT) \
@USE_LIBTOOL_FALSE@tmpfile.$(OBJEXT) tmpnam.$(OBJEXT) ungetc.$(OBJEXT) \
@USE_LIBTOOL_FALSE@vfscanf.$(OBJEXT) vprintf.$(OBJEXT) vscanf.$(OBJEXT) \
@USE_LIBTOOL_FALSE@vasprintf.$(OBJEXT) vfscanf.$(OBJEXT) \
@USE_LIBTOOL_FALSE@vprintf.$(OBJEXT) vscanf.$(OBJEXT) \
@USE_LIBTOOL_FALSE@vsnprintf.$(OBJEXT) vsprintf.$(OBJEXT) \
@USE_LIBTOOL_FALSE@vsscanf.$(OBJEXT) wbuf.$(OBJEXT) wsetup.$(OBJEXT)
LTLIBRARIES = $(noinst_LTLIBRARIES)
@USE_LIBTOOL_TRUE@libstdio_la_DEPENDENCIES = vfiprintf.$(oext) \
@USE_LIBTOOL_TRUE@vfprintf.$(oext)
@USE_LIBTOOL_TRUE@libstdio_la_OBJECTS = clearerr.lo fclose.lo fdopen.lo \
@USE_LIBTOOL_TRUE@feof.lo ferror.lo fflush.lo fgetc.lo fgetpos.lo \
@USE_LIBTOOL_TRUE@fgets.lo fileno.lo findfp.lo fiprintf.lo flags.lo \
@USE_LIBTOOL_TRUE@fopen.lo fprintf.lo fputc.lo fputs.lo fread.lo \
@USE_LIBTOOL_TRUE@freopen.lo fscanf.lo fseek.lo fsetpos.lo ftell.lo \
@USE_LIBTOOL_TRUE@fvwrite.lo fwalk.lo fwrite.lo getc.lo getchar.lo \
@USE_LIBTOOL_TRUE@getc_u.lo getchar_u.lo getdelim.lo getline.lo gets.lo \
@USE_LIBTOOL_TRUE@getw.lo iprintf.lo makebuf.lo mktemp.lo perror.lo \
@USE_LIBTOOL_TRUE@printf.lo putc.lo putchar.lo putc_u.lo putchar_u.lo \
@USE_LIBTOOL_TRUE@puts.lo putw.lo refill.lo remove.lo rename.lo \
@USE_LIBTOOL_TRUE@rewind.lo rget.lo scanf.lo setbuf.lo setbuffer.lo \
@USE_LIBTOOL_TRUE@setlinebuf.lo setvbuf.lo siprintf.lo snprintf.lo \
@USE_LIBTOOL_TRUE@sprintf.lo sscanf.lo stdio.lo tmpfile.lo tmpnam.lo \
@USE_LIBTOOL_TRUE@ungetc.lo vfscanf.lo vprintf.lo vscanf.lo \
@USE_LIBTOOL_TRUE@vsnprintf.lo vsprintf.lo vsscanf.lo wbuf.lo wsetup.lo
@USE_LIBTOOL_TRUE@libstdio_la_OBJECTS = asprintf.lo clearerr.lo \
@USE_LIBTOOL_TRUE@fclose.lo fdopen.lo feof.lo ferror.lo fflush.lo \
@USE_LIBTOOL_TRUE@fgetc.lo fgetpos.lo fgets.lo fileno.lo findfp.lo \
@USE_LIBTOOL_TRUE@fiprintf.lo flags.lo fopen.lo fprintf.lo fputc.lo \
@USE_LIBTOOL_TRUE@fputs.lo fread.lo freopen.lo fscanf.lo fseek.lo \
@USE_LIBTOOL_TRUE@fsetpos.lo ftell.lo fvwrite.lo fwalk.lo fwrite.lo \
@USE_LIBTOOL_TRUE@getc.lo getchar.lo getc_u.lo getchar_u.lo getdelim.lo \
@USE_LIBTOOL_TRUE@getline.lo gets.lo getw.lo iprintf.lo makebuf.lo \
@USE_LIBTOOL_TRUE@mktemp.lo perror.lo printf.lo putc.lo putchar.lo \
@USE_LIBTOOL_TRUE@putc_u.lo putchar_u.lo puts.lo putw.lo refill.lo \
@USE_LIBTOOL_TRUE@remove.lo rename.lo rewind.lo rget.lo scanf.lo \
@USE_LIBTOOL_TRUE@setbuf.lo setbuffer.lo setlinebuf.lo setvbuf.lo \
@USE_LIBTOOL_TRUE@siprintf.lo snprintf.lo sprintf.lo sscanf.lo stdio.lo \
@USE_LIBTOOL_TRUE@tmpfile.lo tmpnam.lo ungetc.lo vasprintf.lo \
@USE_LIBTOOL_TRUE@vfscanf.lo vprintf.lo vscanf.lo vsnprintf.lo \
@USE_LIBTOOL_TRUE@vsprintf.lo vsscanf.lo wbuf.lo wsetup.lo
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)

View File

@ -0,0 +1,95 @@
/*
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by the University of California, Berkeley. The name of the
* University may not be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
/* This code was copied from sprintf.c */
#include <stdio.h>
#ifdef _HAVE_STDC
#include <stdarg.h>
#else
#include <varargs.h>
#endif
#include <limits.h>
#include <_ansi.h>
#include "local.h"
int
#ifdef _HAVE_STDC
_DEFUN (asprintf_r, (ptr, strp, fmt), struct _reent *ptr _AND char **strp _AND _CONST char *fmt _DOTS)
#else
_asprintf_r (ptr, strp, fmt, va_alist)
struct _reent *ptr;
char **strp;
_CONST char *fmt;
va_dcl
#endif
{
int ret;
va_list ap;
FILE f;
/* mark a zero-length reallocatable buffer */
f._flags = __SWR | __SSTR | __SMBF;
f._bf._base = f._p = NULL;
f._bf._size = f._w = 0;
f._data = ptr;
#ifdef _HAVE_STDC
va_start (ap, fmt);
#else
va_start (ap);
#endif
ret = vfprintf (&f, fmt, ap);
va_end (ap);
*f._p = 0;
*strp = f._bf._base;
return (ret);
}
#ifndef _REENT_ONLY
int
#ifdef _HAVE_STDC
_DEFUN (asprintf, (strp, fmt), char **strp _AND _CONST char *fmt _DOTS)
#else
asprintf (strp, fmt, va_alist)
char **strp;
_CONST char *fmt;
va_dcl
#endif
{
int ret;
va_list ap;
FILE f;
/* mark a zero-length reallocatable buffer */
f._flags = __SWR | __SSTR | __SMBF;
f._bf._base = f._p = NULL;
f._bf._size = f._w = 0;
f._data = _REENT;
#ifdef _HAVE_STDC
va_start (ap, fmt);
#else
va_start (ap);
#endif
ret = vfprintf (&f, fmt, ap);
va_end (ap);
*f._p = 0;
*strp = f._bf._base;
return (ret);
}
#endif

View File

@ -19,6 +19,7 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "local.h"
#include "fvwrite.h"
@ -110,7 +111,9 @@ __sfvwrite (fp, uio)
* as fit, but pretend we wrote everything. This makes
* snprintf() return the number of bytes needed, rather
* than the number used, and avoids its write function
* (so that the write function can be invalid).
* (so that the write function can be invalid). If
* we are dealing with the asprintf routines, we will
* dynamically increase the buffer size as needed.
*/
do
{
@ -118,6 +121,19 @@ __sfvwrite (fp, uio)
w = fp->_w;
if (fp->_flags & __SSTR)
{
if (len > w && fp->_flags & __SMBF)
{ /* must be asprintf family */
unsigned char *ptr;
int curpos = (fp->_p - fp->_bf._base);
ptr = (unsigned char *)_realloc_r (fp->_data, fp->_bf._base,
curpos + len);
if (!ptr)
goto err;
fp->_bf._base = ptr;
fp->_p = ptr + curpos;
fp->_bf._size = curpos + len;
w = fp->_w = len;
}
if (len < w)
w = len;
COPY (w); /* copy MIN(fp->_w,len), */

View File

@ -18,11 +18,13 @@
/*
FUNCTION
<<printf>>, <<fprintf>>, <<sprintf>>, <<snprintf>>---format output
<<printf>>, <<fprintf>>, <<saprintf>>, <<sprintf>>, <<snprintf>>---format output
INDEX
fprintf
INDEX
printf
INDEX
saprintf
INDEX
sprintf
INDEX
@ -34,6 +36,7 @@ ANSI_SYNOPSIS
int printf(const char *<[format]> [, <[arg]>, ...]);
int fprintf(FILE *<[fd]>, const char *<[format]> [, <[arg]>, ...]);
int sprintf(char *<[str]>, const char *<[format]> [, <[arg]>, ...]);
int saprintf(char **<[strp]>, const char *<[format]> [, <[arg]>, ...]);
int snprintf(char *<[str]>, size_t <[size]>, const char *<[format]> [, <[arg]>, ...]);
TRAD_SYNOPSIS
@ -46,6 +49,10 @@ TRAD_SYNOPSIS
FILE *<[fd]>;
char *<[format]>;
int saprintf(<[strp]>, <[format]> [, <[arg]>, ...]);
char **<[strp]>;
char *<[format]>;
int sprintf(<[str]>, <[format]> [, <[arg]>, ...]);
char *<[str]>;
char *<[format]>;
@ -65,19 +72,22 @@ DESCRIPTION
If there are more arguments than the format requires, excess
arguments are ignored.
<<fprintf>>, <<sprintf>> and <<snprintf>> are identical to <<printf>>,
other than the destination of the formatted output: <<fprintf>> sends
the output to a specified file <[fd]>, while <<sprintf>> stores the
output in the specified char array <[str]> and <<snprintf>> limits
number of characters written to <[str]> to at most <[size]> (including
terminating <<0>>). For <<sprintf>> and <<snprintf>>, the behavior is
also undefined if the output <<*<[str]>>> overlaps with one of the
arguments. <[format]> is a pointer to a charater string containing
two types of objects: ordinary characters (other than <<%>>), which
are copied unchanged to the output, and conversion
specifications, each of which is introduced by <<%>>.
(To include <<%>> in the output, use <<%%>> in the format string.)
A conversion specification has the following form:
<<fprintf>>, <<saprintf>>, <<sprintf>> and <<snprintf>> are identical
to <<printf>>, other than the destination of the formatted output:
<<fprintf>> sends the output to a specified file <[fd]>, while
<<saprintf>> stores the output in a dynamically allocated buffer,
while <<sprintf>> stores the output in the specified char array
<[str]> and <<snprintf>> limits number of characters written to
<[str]> to at most <[size]> (including terminating <<0>>). For
<<sprintf>> and <<snprintf>>, the behavior is undefined if the
output <<*<[str]>>> overlaps with one of the arguments. For
<<saprintf>>, <[strp]> points to a pointer to char which is filled
in with the dynamically allocated buffer. <[format]> is a pointer
to a charater string containing two types of objects: ordinary
characters (other than <<%>>), which are copied unchanged to the
output, and conversion specifications, each of which is introduced
by <<%>>. (To include <<%>> in the output, use <<%%>> in the format
string.) A conversion specification has the following form:
. %[<[flags]>][<[width]>][.<[prec]>][<[size]>][<[type]>]
@ -272,11 +282,11 @@ O-
RETURNS
<<sprintf>> returns the number of bytes in the output string,
<<sprintf>> and <<saprintf>> return the number of bytes in the output string,
save that the concluding <<NULL>> is not counted.
<<printf>> and <<fprintf>> return the number of characters transmitted.
If an error occurs, <<printf>> and <<fprintf>> return <<EOF>>. No
error returns occur for <<sprintf>>.
If an error occurs, <<printf>> and <<fprintf>> return <<EOF>> and
<<saprintf>> returns -1. No error returns occur for <<sprintf>>.
PORTABILITY
The ANSI C standard specifies that implementations must

View File

@ -0,0 +1,74 @@
/* doc in vfprintf.c */
/*
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by the University of California, Berkeley. The name of the
* University may not be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
/* This code was based on vsprintf.c */
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "%W% (Berkeley) %G%";
#endif /* LIBC_SCCS and not lint */
#include <_ansi.h>
#include <reent.h>
#include <stdio.h>
#include <limits.h>
#ifdef _HAVE_STDC
#include <stdarg.h>
#else
#include <varargs.h>
#endif
int
_DEFUN (vasprintf, (strp, fmt, ap),
char **strp _AND
_CONST char *fmt _AND
va_list ap)
{
int ret;
FILE f;
f._flags = __SWR | __SSTR | __SMBF;
f._bf._base = f._p = NULL;
f._bf._size = f._w = 0;
f._data = _REENT;
ret = vfprintf (&f, fmt, ap);
*f._p = 0;
*strp = f._bf._base;
return ret;
}
int
_DEFUN (_vasprintf_r, (ptr, strp, fmt, ap),
struct _reent *ptr _AND
char **strp _AND
_CONST char *fmt _AND
va_list ap)
{
int ret;
FILE f;
f._flags = __SWR | __SSTR | __SMBF ;
f._bf._base = f._p = NULL;
f._bf._size = f._w = 0;
f._data = ptr;
ret = _vfprintf_r (ptr, &f, fmt, ap);
*f._p = 0;
*strp = f._bf._base;
return ret;
}

View File

@ -17,12 +17,15 @@ ANSI_SYNOPSIS
int vprintf(const char *<[fmt]>, va_list <[list]>);
int vfprintf(FILE *<[fp]>, const char *<[fmt]>, va_list <[list]>);
int vsprintf(char *<[str]>, const char *<[fmt]>, va_list <[list]>);
int vasprintf(char **<[strp]>, const char *<[fmt]>, va_list <[list]>);
int vsnprintf(char *<[str]>, size_t <[size]>, const char *<[fmt]>, va_list <[list]>);
int _vprintf_r(void *<[reent]>, const char *<[fmt]>,
va_list <[list]>);
int _vfprintf_r(void *<[reent]>, FILE *<[fp]>, const char *<[fmt]>,
va_list <[list]>);
int _vasprintf_r(void *<[reent]>, char **<[str]>, const char *<[fmt]>,
va_list <[list]>);
int _vsprintf_r(void *<[reent]>, char *<[str]>, const char *<[fmt]>,
va_list <[list]>);
int _vsnprintf_r(void *<[reent]>, char *<[str]>, size_t <[size]>, const char *<[fmt]>,
@ -40,6 +43,11 @@ TRAD_SYNOPSIS
char *<[fmt]>;
va_list <[list]>;
int vasprintf(<[strp]>, <[fmt]>, <[list]>)
char **<[strp]>;
char *<[fmt]>;
va_list <[list]>;
int vsprintf(<[str]>, <[fmt]>, <[list]>)
char *<[str]>;
char *<[fmt]>;
@ -62,6 +70,12 @@ TRAD_SYNOPSIS
char *<[fmt]>;
va_list <[list]>;
int _vasprintf_r(<[reent]>, <[strp]>, <[fmt]>, <[list]>)
char *<[reent]>;
char **<[strp]>;
char *<[fmt]>;
va_list <[list]>;
int _vsprintf_r(<[reent]>, <[str]>, <[fmt]>, <[list]>)
char *<[reent]>;
char *<[str]>;
@ -76,19 +90,19 @@ TRAD_SYNOPSIS
va_list <[list]>;
DESCRIPTION
<<vprintf>>, <<vfprintf>>, <<vsprintf>> and <<vsnprintf>> are (respectively)
variants of <<printf>>, <<fprintf>>, <<sprintf>> and <<snprintf>>. They differ
only in allowing their caller to pass the variable argument list as a
<<va_list>> object (initialized by <<va_start>>) rather than directly
accepting a variable number of arguments.
<<vprintf>>, <<vfprintf>>, <<vasprintf>>, <<vsprintf>> and <<vsnprintf>> are
(respectively) variants of <<printf>>, <<fprintf>>, <<saprintf>>, <<sprintf>>,
and <<snprintf>>. They differ only in allowing their caller to pass the
variable argument list as a <<va_list>> object (initialized by <<va_start>>)
rather than directly accepting a variable number of arguments.
RETURNS
The return values are consistent with the corresponding functions:
<<vsprintf>> returns the number of bytes in the output string,
<<vasprintf>>/<<vsprintf>> returns the number of bytes in the output string,
save that the concluding <<NULL>> is not counted.
<<vprintf>> and <<vfprintf>> return the number of characters transmitted.
If an error occurs, <<vprintf>> and <<vfprintf>> return <<EOF>>. No
error returns occur for <<vsprintf>>.
If an error occurs, <<vprintf>> and <<vfprintf>> return <<EOF>> and
<<vasprintf>> returns -1. No error returns occur for <<vsprintf>>.
PORTABILITY
ANSI C requires all three functions.