This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: ftstc implementation
- From: "Carlos O'Donell" <carlos at systemhalted dot org>
- To: Suhas Chakravarty <suhas dot chakravarty at gmail dot com>
- Cc: "libc-help at sourceware dot org" <libc-help at sourceware dot org>
- Date: Mon, 11 Aug 2014 08:39:59 +0200
- Subject: Re: ftstc implementation
- Authentication-results: sourceware.org; auth=none
- References: <CABKwiS_RQpKE6Q_SM9QS-bH-6wDEP+nOMhiEaU7h6hS7dJfs1w at mail dot gmail dot com> <CABKwiS8fc=Mx92i0tiO0O-PS-ahmfwqL6gK-_NsRrEht+51s1Q at mail dot gmail dot com> <CAE2sS1gr4w9uXzOfeFUW1tphGMyeJKMdqaQB6-rtonn1Vrk3Dw at mail dot gmail dot com> <CABKwiS9X2g6FkLExx5sLqcDMK2d0fhBxJCADaje0ZXv=nzBvVQ at mail dot gmail dot com>
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