2 @section Replacement for Stdio Formatting Library
4 Using the `printf' formatting routines in a portable fashion has
5 always been a pain, and this package has been way more pain than anyone
6 ever imagined. Hopefully, with this release of snprintfv, the pain is
9 The issues with portable usage are these:
13 Argument number specifiers are often either not implemented or are
14 buggy. Even GNU libc, version 1 got it wrong.
17 ANSI/ISO "forgot" to provide a mechanism for computing argument
18 lists for vararg procedures.
21 The argument array version of printf (`printfv()') is not
22 generally available, does not work with the native printf, and
23 does not have a working argument number specifier in the format
24 specification. (Last I knew, anyway.)
27 You cannot fake varargs by calling `vprintf()' with an array of
28 arguments, because ANSI does not require such an implementation
29 and some vendors play funny tricks because they are allowed to.
32 These four issues made it impossible for AutoGen to ship without its
33 own implementation of the `printf' formatting routines. Since we were
34 forced to do this, we decided to make the formatting routines both
35 better and more complete :-). We addressed these issues and added the
36 following features to the common printf API:
40 The formatted output can be written to
44 a string allocated by the formatting function (`asprintf()').
46 a file descriptor instead of a file stream (`dprintf()').
48 a user specified stream (`stream_printf()').
52 The formatting functions can be augmented with your own functions.
53 These functions are allowed to consume more than one character
54 from the format, but must commence with a unique character. For
61 might be used with '@{' registered to a procedure that would look
62 up "struct stat" in a symbol table and do appropriate things,
63 consuming the format string through the '@}' character.
66 Gary V. Vaughan was generous enough to supply this implementation.
69 For further details, the reader is referred to the snprintfv
70 documentation. These functions are also available in the template
71 processing as@: `sprintf' (@pxref{SCM sprintf}), `printf'
72 (@pxref{SCM printf}), `fprintf' (@pxref{SCM fprintf}), and `shellf'