Subject: Re: INPUT_LEFT macro?
To: None <current-users@NetBSD.ORG>
From: Greg A. Woods <>
List: current-users
Date: 08/09/1995 12:11:25
[ On Tue, August  8, 1995 at 14:38:53 (-0400), der Mouse wrote: ]
> Subject: Re:  INPUT_LEFT macro?
> Unfortunately, when stdio was designed, no interface was included to do
> what that code wants to do.  Thus, there is no generally portable way
> to do it; you have to either stop using stdio or do something
> system-dependent.  It may be accessing an internal field, the way the
> code you quote does, or it may be some non-standardized stdio call....

There's a nasty little script included with smail-3 written by Simon
Leinen <> that does something like this.  Here's the
header comment at the top:

# This script tries to generate a file "iobpeek.h" which defines one
# macro, IOB_MAYBE_EMPTY_P.  The macro can be called with one
# argument, a stdio input stream, and must return a non-zero value if
# the stream's buffer is empty.  If there are characters in the input
# buffer, it *should* return zero.

This script seems to work on everything smail-3 runs on, including
BSDI-1.x, NetBSD-1.0, and NetBSD-current.

If you really want to ditch stdio, I'd recommend looking long and hard
at using instead of
writing a whole lot of system-dependent stuff.

							Greg A. Woods

+1 416 443-1734			VE3TCP			robohack!woods
Planix, Inc. <>; Secrets Of The Weird <>