1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-02 13:00:26 +02:00

(fport_input_waiting): For ioctl, check HAVE_IOCTL as well

as defined(FIONREAD), since mingw has FIONREAD but not ioctl().
Reported by "The Senator".
For select and ioctl, move fdes into those conditionals, to avoid
unused variable warning when neither of those used.
This commit is contained in:
Kevin Ryde 2006-05-26 00:24:03 +00:00
parent 3b3a44557e
commit 83af35ed9b

View file

@ -458,9 +458,8 @@ scm_fdes_to_port (int fdes, char *mode, SCM name)
static int
fport_input_waiting (SCM port)
{
int fdes = SCM_FSTREAM (port)->fdes;
#ifdef HAVE_SELECT
int fdes = SCM_FSTREAM (port)->fdes;
struct timeval timeout;
SELECT_TYPE read_set;
SELECT_TYPE write_set;
@ -480,10 +479,15 @@ fport_input_waiting (SCM port)
< 0)
scm_syserror ("fport_input_waiting");
return FD_ISSET (fdes, &read_set) ? 1 : 0;
#elif defined (FIONREAD)
#elif HAVE_IOCTL && defined (FIONREAD)
/* Note: cannot test just defined(FIONREAD) here, since mingw has FIONREAD
(for use with winsock ioctlsocket()) but not ioctl(). */
int fdes = SCM_FSTREAM (port)->fdes;
int remir;
ioctl(fdes, FIONREAD, &remir);
return remir;
#else
scm_misc_error ("fport_input_waiting",
"Not fully implemented on this platform",