This is the mail archive of the libc-help@sourceware.org mailing list for the glibc 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: ftstc implementation


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


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