From b9db5292223d1e716a126b5db8a69391ba4ef73e Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Fri, 4 May 2007 02:55:16 +0000 Subject: Add support for asnprintf, and improve *printf documentation. * libc/stdio/Makefile.am (ELIX_SOURCES): Rename... (ELIX_2_SOURCES): ...to this. (ELIX_4_SOURCES): Add new variable. Build asnprintf. (GENERAL_SOURCES): Move dprintf to ELIX_4_SOURCES. (CHEWOUT_FILES): Include diprintf in documentation. * libc/stdio/Makefile.in: Regenerate. * libc/stdio/diprintf.c: Improve documentation. * libc/stdio/dprintf.c: Likewise. * libc/stdio/siprintf.c: Likewise. * libc/stdio/sprintf.c: Likewise. * libc/stdio/vfprintf.c: Likewise. * libc/stdio/viprintf.c: Likewise. * libc/stdio/vsniprintf.c: Consolidate documentation. * libc/stdio/asiprintf.c: Refer to documentation. * libc/stdio/asprintf.c: Likewise. * libc/stdio/fiprintf.c: Likewise. * libc/stdio/fprintf.c: Likewise. * libc/stdio/iprintf.c: Likewise. * libc/stdio/printf.c: Likewise. * libc/stdio/sniprintf.c: Likewise. * libc/stdio/vdiprintf.c: Likewise. * libc/stdio/vdprintf.c: Likewise. * libc/stdio/vsiprintf.c: Likewise. * libc/stdio/fvwrite.c (__sfvwrite_r): Handle asnprintf. * libc/stdio/asniprintf.c (asniprintf, _asniprintf_r): New file. * libc/stdio/asnprintf.c (asnprintf, _asnprintf_r): New file. * libc/stdio/vasniprintf.c (vasniprintf, _vasniprintf_r): New file. * libc/stdio/vasnprintf.c (vasnprintf, _vasnprintf_r): New file. * libc/stdio/vdprintf.c (_vdprintf_r): Rewrite to avoid malloc in typical case. * libc/stdio/vdiprintf.c (_vdiprintf_r): Likewise. * libc/include/stdio.h: Add prototypes for new functions; sort existing functions. --- newlib/libc/stdio/siprintf.c | 72 +++++++++++++++++++++----------------------- 1 file changed, 34 insertions(+), 38 deletions(-) (limited to 'newlib/libc/stdio/siprintf.c') diff --git a/newlib/libc/stdio/siprintf.c b/newlib/libc/stdio/siprintf.c index 4e8e95aaa..d2b4e76c9 100644 --- a/newlib/libc/stdio/siprintf.c +++ b/newlib/libc/stdio/siprintf.c @@ -17,18 +17,20 @@ /* FUNCTION - <>, <>, <>, <>, <>---format output +<>, <>, <>, <>, <>, <>---format output (integer only) INDEX fiprintf INDEX iprintf -INDEX - asiprintf INDEX siprintf INDEX sniprintf +INDEX + asiprintf +INDEX + asniprintf ANSI_SYNOPSIS #include @@ -36,50 +38,44 @@ ANSI_SYNOPSIS int iprintf(const char *<[format]> [, <[arg]>, ...]); int fiprintf(FILE *<[fd]>, const char *<[format]> [, <[arg]>, ...]); int siprintf(char *<[str]>, const char *<[format]> [, <[arg]>, ...]); - int asiprintf(char **<[strp]>, const char *<[format]> [, <[arg]>, ...]); int sniprintf(char *<[str]>, size_t <[size]>, const char *<[format]> [, <[arg]>, ...]); - -TRAD_SYNOPSIS - #include - - int iprintf(<[format]> [, <[arg]>, ...]) - char *<[format]>; - - int fiprintf(<[fd]>, <[format]> [, <[arg]>, ...]); - FILE *<[fd]>; - char *<[format]>; - - int asiprintf(<[strp]>, <[format]> [, <[arg]>, ...]); - char **<[strp]>; - char *<[format]>; - - int siprintf(<[str]>, <[format]> [, <[arg]>, ...]); - char *<[str]>; - char *<[format]>; - - int sniprintf(<[str]>, size_t <[size]>, <[format]> [, <[arg]>, ...]); - char *<[str]>; - size_t <[size]>; - char *<[format]>; + int asiprintf(char **<[strp]>, const char *<[format]> [, <[arg]>, ...]); + char *asniprintf(char *<[str]>, size_t *<[size]>, const char *<[format]> + [, <[arg]>, ...]); + + int _iprintf_r(struct _reent *<[ptr]>, const char *<[format]> + [, <[arg]>, ...]); + int _fiprintf_r(struct _reent *<[ptr]>, FILE *<[fd]>, + const char *<[format]> [, <[arg]>, ...]); + int _siprintf_r(struct _reent *<[ptr]>, char *<[str]>, + const char *<[format]> [, <[arg]>, ...]); + int _sniprintf_r(struct _reent *<[ptr]>, char *<[str]>, size_t <[size]>, + const char *<[format]> [, <[arg]>, ...]); + int _asiprintf_r(struct _reent *<[ptr]>, char **<[strp]>, + const char *<[format]> [, <[arg]>, ...]); + char *_asniprintf_r(struct _reent *<[ptr]>, char *<[str]>, + size_t *<[size]>, const char *<[format]> + [, <[arg]>, ...]); DESCRIPTION <>, <>, <>, <>, - <>, are the same as <>, <>, - <>, <>, and <>, respectively, - only that they restrict usage to non-floating-point format - specifiers. + <>, and <> are the same as <>, + <>, <>, <>, <>, and + <>, respectively, except that they restrict usage + to non-floating-point format specifiers. + + <<_iprintf_r>>, <<_fiprintf_r>>, <<_asiprintf_r>>, + <<_siprintf_r>>, <<_sniprintf_r>>, <<_asniprintf_r>> are + simply reentrant versions of the functions above. RETURNS -<> 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 <> and -<> returns -1. No error returns occur for <>. +Similar to <>, <>, <>, <>, <>, +and <>. PORTABILITY -<>, <>, <>, <>, and <> -are newlib extensions. +<>, <>, <>, <>, <>, +and <> are newlib extensions. Supporting OS subroutines required: <>, <>, <>, <>, <>, <>, <>. -- cgit v1.2.3