[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: glibc related porting questions
From: |
Marcus Brinkmann |
Subject: |
Re: glibc related porting questions |
Date: |
Thu, 9 Aug 2001 03:29:51 +0200 |
User-agent: |
Mutt/1.3.20i |
On Mon, Jul 23, 2001 at 07:32:10PM -0400, Roland McGrath wrote:
> > 2. There is a READ_DATA_PENDING macro to determine the available bytes
> > for reading(?) on various systems. Seems to be a highly inofficial
> > thing. Anyways, the GLibC support there relies on _STDIO_USES_IOSTREAM,
> > which we don't define. What will work for us with our stdio?
>
> Add a configure check for stdio_ext.h and use those interfaces. They exist
> in libio since glibc-2.2, and it so happens I just added them for stdio
> this weekend (you need to test the new code because I haven't).
I don't see anything there that returns how much (or if) can be read.
The closest thing is __fpending, but this returns the number of pending
bytes in the output buffer, not input buffer.
Here is the relevant code from icon, which has a similar issue:
FILE *f;
/* check for data already in buffer */
/* there's no legal way to do this in C; we cheat */
#ifdef __linux
if (f->_IO_read_ptr < f->_IO_read_end)
RetArg(1);
#elif __bsdi__ || __FreeBSD__ || __NetBSD__ || __OpenBSD__
if (f->_r > 0)
RetArg(1);
#else
if (f->_cnt > 0)
RetArg(1);
#endif
Thanks,
Marcus
--
`Rhubarb is no Egyptian god.' Debian http://www.debian.org brinkmd@debian.org
Marcus Brinkmann GNU http://www.gnu.org marcus@gnu.org
Marcus.Brinkmann@ruhr-uni-bochum.de
http://www.marcus-brinkmann.de
- Re: glibc related porting questions,
Marcus Brinkmann <=