'\"macro stdmacro
.if n .pH g2.rdchk @(#)rdchk	40.4 of 8/31/89
.nr X
.if \nX=0 .ds x} rdchk 2 "XENIX Compatibility Package" "\&"
.if \nX=1 .ds x} rdchk 2 "XENIX Compatibility Package"
.if \nX=2 .ds x} rdchk 2 "" "\&"
.if \nX=3 .ds x} rdchk "" "" "\&"
.TH \*(x}
.SH NAME
\f4rdchk\f1 \- checks to see if there is data to be read
.SH SYNOPSIS
\f4cc [flag ...]\fP \f2file\f1 ... \f4-lx
.br
\f4rdchk(int fdes)\fP;
.SH DESCRIPTION
\f4rdchk\f1
checks to see if a process will block if it attempts to
read the file designated by \f4fdes\f1.
\f4rdchk\f1
returns 
\f41\f1
if there is data
to be read or if it is the end of the file (\f4EOF\f1).
In this context, the proper sequence of calls using
\f4rdchk\f1
is:
.RS
.ft CW
.nf
if(rdchk(fildes) > 0)
    read(fildes, buffer, nbytes);
.fi
.RE
.SH DIAGNOSTICS
\f4rdchk\f1
returns
\f4-1\f1
if an error occurs
(e.g., \f4EBADF\f1),
\f40\f1
if the process will block if it issues a
\f4read\f1
and
\f41\f1
if it is okay to read.
\f4EBADF\f1 is returned if a
\f4rdchk\f1
is done on a semaphore file or if the file specified
doesn't exist.
.SH SEE ALSO
\f4read\f1(2)
