From 7501704dc9dc7337e621db87ada8901a496766d9 Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Thu, 4 Jul 2002 18:56:17 +0000 Subject: 2002-07-04 Jeff Johnston * 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. --- newlib/libc/stdio/Makefile.am | 2 + newlib/libc/stdio/Makefile.in | 57 ++++++++++++++------------ newlib/libc/stdio/asprintf.c | 95 +++++++++++++++++++++++++++++++++++++++++++ newlib/libc/stdio/fvwrite.c | 18 +++++++- newlib/libc/stdio/sprintf.c | 44 ++++++++++++-------- newlib/libc/stdio/vasprintf.c | 74 +++++++++++++++++++++++++++++++++ newlib/libc/stdio/vfprintf.c | 30 ++++++++++---- 7 files changed, 268 insertions(+), 52 deletions(-) create mode 100644 newlib/libc/stdio/asprintf.c create mode 100644 newlib/libc/stdio/vasprintf.c (limited to 'newlib/libc/stdio') diff --git a/newlib/libc/stdio/Makefile.am b/newlib/libc/stdio/Makefile.am index b7eaab8e4..8e3f719ba 100644 --- a/newlib/libc/stdio/Makefile.am +++ b/newlib/libc/stdio/Makefile.am @@ -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 \ diff --git a/newlib/libc/stdio/Makefile.in b/newlib/libc/stdio/Makefile.in index 7210cb771..df8e5e7c7 100644 --- a/newlib/libc/stdio/Makefile.in +++ b/newlib/libc/stdio/Makefile.in @@ -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) diff --git a/newlib/libc/stdio/asprintf.c b/newlib/libc/stdio/asprintf.c new file mode 100644 index 000000000..9935c125b --- /dev/null +++ b/newlib/libc/stdio/asprintf.c @@ -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 +#ifdef _HAVE_STDC +#include +#else +#include +#endif +#include +#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 diff --git a/newlib/libc/stdio/fvwrite.c b/newlib/libc/stdio/fvwrite.c index 62d0ba072..fe0e80111 100644 --- a/newlib/libc/stdio/fvwrite.c +++ b/newlib/libc/stdio/fvwrite.c @@ -19,6 +19,7 @@ #include #include +#include #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), */ diff --git a/newlib/libc/stdio/sprintf.c b/newlib/libc/stdio/sprintf.c index b5376327e..6e6750145 100644 --- a/newlib/libc/stdio/sprintf.c +++ b/newlib/libc/stdio/sprintf.c @@ -18,11 +18,13 @@ /* FUNCTION - <>, <>, <>, <>---format output + <>, <>, <>, <>, <>---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. - <>, <> and <> are identical to <>, - other than the destination of the formatted output: <> sends - the output to a specified file <[fd]>, while <> stores the - output in the specified char array <[str]> and <> limits - number of characters written to <[str]> to at most <[size]> (including - terminating <<0>>). For <> and <>, 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: + <>, <>, <> and <> are identical + to <>, other than the destination of the formatted output: + <> sends the output to a specified file <[fd]>, while + <> stores the output in a dynamically allocated buffer, + while <> stores the output in the specified char array + <[str]> and <> limits number of characters written to + <[str]> to at most <[size]> (including terminating <<0>>). For + <> and <>, the behavior is undefined if the + output <<*<[str]>>> overlaps with one of the arguments. For + <>, <[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 -<> returns the number of bytes in the output string, +<> and <> return the number of bytes in the output string, save that the concluding <> is not counted. <> and <> return the number of characters transmitted. -If an error occurs, <> and <> return <>. No -error returns occur for <>. +If an error occurs, <> and <> return <> and +<> returns -1. No error returns occur for <>. PORTABILITY The ANSI C standard specifies that implementations must diff --git a/newlib/libc/stdio/vasprintf.c b/newlib/libc/stdio/vasprintf.c new file mode 100644 index 000000000..7f35752c7 --- /dev/null +++ b/newlib/libc/stdio/vasprintf.c @@ -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 +#include +#include +#ifdef _HAVE_STDC +#include +#else +#include +#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; +} + diff --git a/newlib/libc/stdio/vfprintf.c b/newlib/libc/stdio/vfprintf.c index 27cc6d911..889a7a083 100644 --- a/newlib/libc/stdio/vfprintf.c +++ b/newlib/libc/stdio/vfprintf.c @@ -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 -<>, <>, <> and <> are (respectively) -variants of <>, <>, <> and <>. They differ -only in allowing their caller to pass the variable argument list as a -<> object (initialized by <>) rather than directly -accepting a variable number of arguments. +<>, <>, <>, <> and <> are +(respectively) variants of <>, <>, <>, <>, +and <>. They differ only in allowing their caller to pass the +variable argument list as a <> object (initialized by <>) +rather than directly accepting a variable number of arguments. RETURNS The return values are consistent with the corresponding functions: -<> returns the number of bytes in the output string, +<>/<> returns the number of bytes in the output string, save that the concluding <> is not counted. <> and <> return the number of characters transmitted. -If an error occurs, <> and <> return <>. No -error returns occur for <>. +If an error occurs, <> and <> return <> and +<> returns -1. No error returns occur for <>. PORTABILITY ANSI C requires all three functions. -- cgit v1.2.3