2 rdesktop: A Remote Desktop Protocol client.
4 Copyright (C) Matthew Chapman 1999-2005
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License along
17 with this program; if not, write to the Free Software Foundation, Inc.,
18 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 //#include <winsock2.h> /* winsock2.h first */
32 #include <sys/types.h>
34 #ifdef HAVE_SYS_SELECT_H
35 #include <sys/select.h>
36 #else /* HAVE_SYS_SELECT_H */
37 #include <sys/types.h>
39 #endif /* HAVE_SYS_SELECT_H */
41 #include <limits.h> /* PATH_MAX */
43 #define VERSION "1.4.1"
46 #define DEBUG(args) printf args;
52 #define DEBUG_KBD(args) printf args;
54 #define DEBUG_KBD(args)
57 #ifdef WITH_DEBUG_RDP5
58 #define DEBUG_RDP5(args) printf args;
60 #define DEBUG_RDP5(args)
63 #ifdef WITH_DEBUG_CLIPBOARD
64 #define DEBUG_CLIPBOARD(args) printf args;
66 #define DEBUG_CLIPBOARD(args)
69 #ifdef WITH_DEBUG_CHANNEL
70 #define DEBUG_CHANNEL(args) printf args;
72 #define DEBUG_CHANNEL(args)
75 #define STRNCPY(dst,src,n) { strncpy(dst,src,n-1); dst[n-1] = 0; }
78 #define MIN(x,y) (((x) < (y)) ? (x) : (y))
82 #define MAX(x,y) (((x) > (y)) ? (x) : (y))
87 #define timerisset(tvp)\
88 ((tvp)->tv_sec || (tvp)->tv_usec)
91 #define timercmp(tvp, uvp, cmp)\
92 ((tvp)->tv_sec cmp (uvp)->tv_sec ||\
93 (tvp)->tv_sec == (uvp)->tv_sec &&\
94 (tvp)->tv_usec cmp (uvp)->tv_usec)
97 #define timerclear(tvp)\
98 ((tvp)->tv_sec = (tvp)->tv_usec = 0)
101 /* If configure does not define the endianess, try
103 #if !defined(L_ENDIAN) && !defined(B_ENDIAN)
104 #if __BYTE_ORDER == __LITTLE_ENDIAN
106 #elif __BYTE_ORDER == __BIG_ENDIAN
109 #error Unknown endianness. Edit rdesktop.h.
111 #endif /* B_ENDIAN, L_ENDIAN from configure */
113 /* No need for alignment on x86 and amd64 */
114 #if !defined(NEED_ALIGN)
115 #if !(defined(__x86__) || defined(__x86_64__) || \
116 defined(__AMD64__) || defined(_M_IX86) || \
123 #include "constants.h"