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/sprintf.c | 44 +++++++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 17 deletions(-) (limited to 'newlib/libc/stdio/sprintf.c') 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 -- cgit v1.2.3