This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: Bug (?) in sprintf family?
- From: Brian Dessent <brian at dessent dot net>
- To: "Jonathan S. Shapiro" <shap at eros-os dot com>
- Cc: newlib at sourceware dot org
- Date: Mon, 07 Apr 2008 13:52:56 -0700
- Subject: Re: Bug (?) in sprintf family?
- References: <1207596006.10263.64.camel@shaptop.om-md.eros-os.com>
- Reply-to: newlib at sourceware dot org
"Jonathan S. Shapiro" wrote:
> Heck, vsnprintf doesn't have a FILE* to work with, so there isn't any
> fd, so I'm not entirely sure what these routines could possibly be
> getting called *on* in this case. The program makes no other use of
> stdio.
The snprintf family of functions are all implemented in terms of
_vfprintf_r, by constructing a pseudo FILE * to represent the string
buffer whose _flags indicate that it's really a string buffer (__SSTR)
and not a file stream. This allows for there to be one implementation
of the actual formatted output code instead of having to duplicate it,
so the coupling is deliberate.
I would think that things like calls to isatty() would be guarded by
!(_flags & __SSTR) but in any case if you just stub out everything
needed to link and the string output ones ought to still work.
Brian