.th empty IV 4/21/86
.sh NAME
empty \*- check whether a pipe is empty
.sh SYNOPSIS
empty(fildes)
.s3
int fildes;
.ft R
.sh DESCRIPTION
Given a file descriptor returned from a pipe call, or a file descriptor
of a tty, empty checks to see whether there are any characters to be
read from the pipe or tty.  More precisely, it checks to see whether a
read on that file descriptor would cause the calling process to be put
to sleep.
.s3
Empty
returns 1 if a read on fildes would hang; otherwise 0.
.s3
.sh "SEE ALSO"
pipe(IV), dup(IV), close(IV), read(IV)
.sh NOTES
A read on an empty pipe with one end closed returns EOF rather than
going to sleep; empty returns 0 in this case.
.sh DIAGNOSTICS
The error bit (c-bit) is set for an unknown file descriptor or for
a file descriptor that doesn't describe a pipe or a tty.
From c a -1 indicates an error.

