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: getchar issues


Here's a slightly different work-around (for if you don't want to call a
printf) in case you need to work with an older library that you don't
have
the liberty to update.  (I use this trick when creating a second I/O
context, which is just doing manually what ends up being done lower
down.)
 
/* Force init done by library routines without needing to call one.  */
__sinit(_impure_ptr);
 
In certain respects it is "dirtier" than a print work-around, but the
need
for either is really dependent upon using newlib.
 
Craig Howland

-----Original Message-----
From: newlib-owner@sourceware.org [mailto:newlib-owner@sourceware.org]
On Behalf Of Jeff Johnston
Sent: Tuesday, March 11, 2008 3:14 PM
To: Matt Lee
Cc: newlib@sources.redhat.com
Subject: Re: getchar issues

Matt,

  Thanks for the analysis.  The solution is that __srget must call 
CHECK_INIT prior
to calling __srefill_r.  This resolves fake stdin to stdin before 
accessing the read buffer.
I have checked in a fix.  Please try it out.

-- Jeff J.

-----Original Message-----
From: newlib-owner@sourceware.org [mailto:newlib-owner@sourceware.org]
On Behalf Of Matt Lee
Sent: Tuesday, March 11, 2008 2:56 PM
To: newlib@sources.redhat.com
Subject: Re: getchar issues
...
The workaround for this is to first invoke a call such as printf()
which initializes stdin so that any subsequent usage of getchar() and
friends uses the right file pointer to start with.

Ideally, this problem should be fixed in __srget (and similiar
functions). But I am not clear on how to do this. Any suggestions?

thanks,
Matt


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