ftstc implementation

Carlos O'Donell carlos@systemhalted.org
Mon Aug 11 06:40:00 GMT 2014


On Mon, Aug 11, 2014 at 7:44 AM, Suhas Chakravarty
<suhas.chakravarty@gmail.com> wrote:
> Hi Carlos
> Sorry about replying late. Yes, I am attempting port a stripped down
> version of uboot to the GNU compiler toolchain. The comments in uboot
> code imply that tstc() and ftstc() are used to test for the presence
> of a character in stdin or a file, without actually reading it. For
> now I have thought of implementing it as a getc() followed by
> ungetc(). Do you think that's a good enough implementation?

U-Boot [1], last I checked 2 years ago, was compilable by gcc, and had
been so for all the years I worked in embedded Linux development.

Are you certain it needs porting or the use of tstc and ftstc?

Yes, I do believe that implementing them using glibc's primitives is
as good a solution as you're going to get for your a first cut of your
work. Without any clear description of the behaviour of the function
(thread safety, signal safety, async-signal safety etc.) you can't
really do better.

Cheers,
Carlos.

[1] http://www.denx.de/wiki/U-Boot



More information about the Libc-help mailing list