EMPTY(II)			15 Mar 75			EMPTY(II)

NAME
	empty - check whether a pipe is empty

SYNOPSIS
	(empty=63.; not in assembler)
	(file descriptor in r0)
	sys empty

	empty(fildes)

DESCRIPTION
	Given a file descriptor returned from a pipe call, empty
	checks to see whether there are any characters to be read from
	the pipe.  More precisely, it checks to see whether a read on
	that file descriptor would cause the calling process to be put
	to sleep.

	empty returns 1 if a read on fildes would hang; otherwise 0.

	(Note: a read on an empty pipe with one end closed returns
	       EOF rather than going to sleep; empty returns 0 in this
	       case.)

SEE ALSO
	pipe(II), dup(II), close(II), read(II)

DIAGNOSTICS
	The error bit (c-bit) is set for an unknown file descriptor or for
	a file descriptor that doesn't describe a pipe.
	From c a -1 indicates an error.

BUGS
	empty should also work for other devices, specifically ttys.
