From f0bc70c24ed31a183a0400c85c2865957752e326 Mon Sep 17 00:00:00 2001 From: Jeroen Meijer Date: Mon, 14 Feb 2005 00:34:23 +0000 Subject: [PATCH] fix compilation on cygwin git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@811 423420c4-83ab-492f-b58f-81f9feb106b5 --- disk.c | 5 ++--- serial.c | 20 +++++++++++++------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/disk.c b/disk.c index 6a0f917..2b0f442 100644 --- a/disk.c +++ b/disk.c @@ -18,6 +18,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include "rdesktop.h" #include "disk.h" #include @@ -67,7 +68,7 @@ #define F_NAMELEN(buf) ((buf).f_namemax) #elif (defined(__alpha) && !defined(linux)) -#include /* osf1 statfs */ +#include /* osf1 statfs */ #define STATFS_FN(path, buf) (statfs(path,buf,sizeof(buf))) #define STATFS_T statfs #define F_NAMELEN(buf) (255) @@ -82,8 +83,6 @@ #define F_NAMELEN(buf) ((buf).f_namelen) #endif -#include "rdesktop.h" - extern RDPDR_DEVICE g_rdpdr_device[]; FILEINFO g_fileinfo[MAX_OPEN_FILES]; diff --git a/serial.c b/serial.c index c62600d..166306d 100644 --- a/serial.c +++ b/serial.c @@ -121,10 +121,10 @@ /* FIONREAD should really do the same thing as TIOCINQ, where it is * not available */ -#ifndef TIOCINQ +#if !defined(TIOCINQ) && defined(FIONREAD) #define TIOCINQ FIONREAD #endif -#ifndef TIOCOUTQ +#if !defined(TIOCOUTQ) && defined(FIONWRITE) #define TIOCOUTQ FIONWRITE #endif @@ -646,7 +646,7 @@ serial_read(NTHANDLE handle, uint8 * data, uint32 length, uint32 offset, uint32 } tcsetattr(handle, TCSANOW, ptermios); -#ifdef WITH_DEBUG_SERIAL +#if defined(WITH_DEBUG_SERIAL) && defined(TIOCINQ) ioctl(handle, TIOCINQ, &bytes_inqueue); DEBUG_SERIAL(("serial_read inqueue: %d expected %d\n", bytes_inqueue, length)); #endif @@ -794,7 +794,8 @@ serial_device_control(NTHANDLE handle, uint32 request, STREAM in, STREAM out) break; case SERIAL_GET_WAIT_MASK: DEBUG_SERIAL(("serial_ioctl -> SERIAL_GET_WAIT_MASK %X\n", - pser_inf->wait_mask); out_uint32(out, pser_inf->wait_mask)); + pser_inf->wait_mask); + out_uint32(out, pser_inf->wait_mask)); break; case SERIAL_SET_WAIT_MASK: in_uint32(in, pser_inf->wait_mask); @@ -854,14 +855,18 @@ serial_device_control(NTHANDLE handle, uint32 request, STREAM in, STREAM out) out_uint32_le(out, 0); /* Hold reasons */ result = 0; +#ifdef TIOCINQ ioctl(handle, TIOCINQ, &result); +#endif out_uint32_le(out, result); /* Amount in in queue */ if (result) DEBUG_SERIAL(("serial_ioctl -> SERIAL_GET_COMMSTATUS in queue %d\n", result)); result = 0; +#ifdef TIOCOUTQ ioctl(handle, TIOCOUTQ, &result); +#endif out_uint32_le(out, result); /* Amount in out queue */ if (result) DEBUG_SERIAL(("serial_ioctl -> SERIAL_GET_COMMSTATUS out queue %d\n", result)); @@ -934,9 +939,9 @@ serial_get_event(NTHANDLE handle, uint32 * result) if (index < 0) return False; +#ifdef TIOCINQ pser_inf = (SERIAL_DEVICE *) g_rdpdr_device[index].pdevice_data; - ioctl(handle, TIOCINQ, &bytes); if (bytes > 0) @@ -972,8 +977,9 @@ serial_get_event(NTHANDLE handle, uint32 * result) { pser_inf->event_rlsd = 0; } +#endif - +#ifdef TIOCOUTQ ioctl(handle, TIOCOUTQ, &bytes); if ((bytes == 0) && (pser_inf->event_txempty > 0) && (pser_inf->wait_mask & SERIAL_EV_TXEMPTY)) @@ -984,7 +990,7 @@ serial_get_event(NTHANDLE handle, uint32 * result) ret = True; } pser_inf->event_txempty = bytes; - +#endif ioctl(handle, TIOCMGET, &bytes); if ((bytes & TIOCM_DSR) != pser_inf->event_dsr)