int GetBytesAvailable (fd) int fd;
int GetBytesAvailable (int fd)
int GetBytesAvailable (fd)    int fd;{#ifndef AMOEBA#ifdef FIONREAD    long arg;    ioctl (fd, FIONREAD, (char *) &arg);    return (int) arg;#else#ifdef MINIX    /* The answer doesn't have to correct. Calling nbio_isinprogress is     * much cheaper than called nbio_select.     */    if (nbio_isinprogress(fd, ASIO_READ))    	return 0;    else        return 1;#else /* !MINIX */#ifdef FIORDCK    return (ioctl (fd, FIORDCHK, NULL));#else /* !FIORDCK */    struct pollfd pollfds[1];    pollfds[0].fd = fd;    pollfds[0].events = POLLIN;    return poll (pollfds, 1, 0);#endif /* FIORDCK */#endif /* MINIX */#endif#else    /*     * Since this routine is only used to poll X connections     * we can use an internal Xlib routine (oh what ugly).     */    register TScreen *screen = &term->screen;    int count;    if (ConnectionNumber(screen->display) != fd) {	Panic("Cannot get bytes available");	return -1;    }    return _X11TransAmFdBytesReadable(fd, &count) < 0 ? -1 : count;#endif /* AMOEBA */}