comparison gui/src/terminal/KPty.cpp @ 13669:803ac0c6a2c0

Fixed bug with including pty.h.
author Jacob Dawid <jacob.dawid@googlemail.com>
date Sat, 10 Sep 2011 20:27:47 +0200
parents 32f4713142d8
children c0e0625ffd13
comparison
equal deleted inserted replaced
13668:421afeae929b 13669:803ac0c6a2c0
21 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 21 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 Boston, MA 02110-1301, USA. 22 Boston, MA 02110-1301, USA.
23 */ 23 */
24 24
25 #include "KPty.h" 25 #include "KPty.h"
26
27 #if defined(Q_OS_MAC)
28 #define HAVE_UTIL_H
29 #define HAVE_UTMPX
30 #define _UTMPX_COMPAT
31 #define HAVE_PTSNAME
32 #define HAVE_SYS_TIME_H
33 #else
34 #define HAVE_PTY_H
35 #endif
36
37 #define HAVE_OPENPTY
38
39 #include <QtCore/QByteArray>
40
41 #ifdef __sgi
42 #define __svr4__
43 #endif
44
45 #ifdef __osf__
46 #define _OSF_SOURCE
47 #include <float.h>
48 #endif
49
50 #ifdef _AIX
51 #define _ALL_SOURCE
52 #endif
53
54 // __USE_XOPEN isn't defined by default in ICC
55 // (needed for ptsname(), grantpt() and unlockpt())
56 #ifdef __INTEL_COMPILER
57 #ifndef __USE_XOPEN
58 #define __USE_XOPEN
59 #endif
60 #endif
61
62 #include <sys/types.h>
63 #include <sys/ioctl.h>
64 #include <sys/time.h>
65 #include <sys/resource.h>
66 #include <sys/stat.h>
67 #include <sys/param.h>
68
69 #include <errno.h>
70 #include <fcntl.h>
71 #include <time.h>
72 #include <stdlib.h>
73 #include <stdio.h>
74 #include <string.h>
75 #include <unistd.h>
76 #include <grp.h>
77
78 #if defined(HAVE_PTY_H)
79 #include <pty.h>
80 #endif
81
82 #ifdef HAVE_LIBUTIL_H
83 #include <libutil.h>
84 #elif defined(HAVE_UTIL_H)
85 #include <util.h>
86 #endif
87
88 #define HAVE_UTMPX
89 #define _UTMPX_COMPAT
90
91 #ifdef HAVE_UTEMPTER
92 extern "C"
93 {
94 #include <utempter.h>
95 }
96 #else
97 #include <utmp.h>
98 #ifdef HAVE_UTMPX
99 #include <utmpx.h>
100 #endif
101 #if !defined(_PATH_UTMPX) && defined(_UTMPX_FILE)
102 #define _PATH_UTMPX _UTMPX_FILE
103 #endif
104 #if !defined(_PATH_WTMPX) && defined(_WTMPX_FILE)
105 #define _PATH_WTMPX _WTMPX_FILE
106 #endif
107 #endif
108
109 /* for HP-UX (some versions) the extern C is needed, and for other
110 platforms it doesn't hurt */
111 extern "C"
112 {
113 #include <termios.h>
114 #if defined(HAVE_TERMIO_H)
115 #include <termio.h> // struct winsize on some systems
116 #endif
117 }
118
119 #if defined (_HPUX_SOURCE)
120 #define _TERMIOS_INCLUDED
121 #include <bsdtty.h>
122 #endif
123
124 #ifdef HAVE_SYS_STROPTS_H
125 #include <sys/stropts.h> // Defines I_PUSH
126 #define _NEW_TTY_CTRL
127 #endif
128
129 #if defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__) || defined (__bsdi__) || defined(__APPLE__) || defined (__DragonFly__)
130 #define _tcgetattr(fd, ttmode) ioctl(fd, TIOCGETA, (char *)ttmode)
131 #else
132 #if defined(_HPUX_SOURCE) || defined(__Lynx__) || defined (__CYGWIN__) || defined(__sun)
133 #define _tcgetattr(fd, ttmode) tcgetattr(fd, ttmode)
134 #else
135 #define _tcgetattr(fd, ttmode) ioctl(fd, TCGETS, (char *)ttmode)
136 #endif
137 #endif
138
139 #if defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__) || defined (__bsdi__) || defined(__APPLE__) || defined (__DragonFly__)
140 #define _tcsetattr(fd, ttmode) ioctl(fd, TIOCSETA, (char *)ttmode)
141 #else
142 #if defined(_HPUX_SOURCE) || defined(__CYGWIN__) || defined(__sun)
143 #define _tcsetattr(fd, ttmode) tcsetattr(fd, TCSANOW, ttmode)
144 #else
145 #define _tcsetattr(fd, ttmode) ioctl(fd, TCSETS, (char *)ttmode)
146 #endif
147 #endif
148 26
149 #include <QtCore/Q_PID> 27 #include <QtCore/Q_PID>
150 28
151 #define TTY_GROUP "tty" 29 #define TTY_GROUP "tty"
152 30