This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Bug (?) in sprintf family?


"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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]