implement asnprintf, take 2

Eric Blake
Mon Apr 30 14:41:00 GMT 2007

Hash: SHA1

According to Jeff Johnston on 4/24/2007 1:03 PM:
> Eric,
>  A number of issues regarding ELIX_LEVEL.  These new functions should be
> level 4.  That means you need a new set of ELIX_4_SOURCES and you simply
> verify that the level is not 1, 2, or 3.  Add ELIX_4_SOURCES to the list
> of sources below.  Very straightforward.
>  This patch has revealed an error I hadn't spotted before.  The dprintf
> family cannot refer to a higher level ELIX function so they must be put
> into the LEVEL 2 sources with asprintf, etc..
>  Finally, the dprintf changes you have made need to either be left out
> or you need to fork the code based on the ELIX level and call the new
> LEVEL 4 functions when the _ELIX_LEVEL flag is undefined or >3.

This version is a bit bigger, because it also improves the documentation
(let me know if I need to split it into two independent patches).  I went
ahead and documented %a, even though it is not implemented yet (I'm still
working on that).  This version also fixes to put dprintf and
asnprintf in ELIX_4_SOURCES.  I've tested that cygwin can still be built
with this patch.

2007-04-28  Eric Blake  <>

	Add support for asnprintf, and improve *printf documentation.
	* libc/stdio/ (ELIX_SOURCES): Rename...
	(ELIX_2_SOURCES): this.
	(ELIX_4_SOURCES): Add new variable.  Build asnprintf.
	(CHEWOUT_FILES): Include diprintf in documentation.
	* 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
	* 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.

- --
Don't work too hard, make some time for fun as well!

Eric Blake   
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at
Comment: Using GnuPG with Mozilla -

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: newlib.patch13
URL: <>

More information about the Newlib mailing list