ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/ptytty.C
(Generate patch)

Comparing rxvt-unicode/src/ptytty.C (file contents):
Revision 1.68 by ayin, Tue Dec 11 21:49:12 2007 UTC vs.
Revision 1.70 by sf-exg, Wed Jul 21 08:46:13 2010 UTC

23 * You should have received a copy of the GNU General Public License 23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software 24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 25 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 *---------------------------------------------------------------------*/ 26 *---------------------------------------------------------------------*/
27 27
28#include "../config.h" 28#include "config.h"
29 29
30#include "ptytty.h" 30#include "ptytty.h"
31 31
32#include <cstdlib> 32#include <cstdlib>
33#include <cstring> 33#include <cstring>
34#include <csignal> 34#include <csignal>
35 35
36#include <sys/types.h> 36#include <sys/types.h>
37#include <sys/stat.h>
37#include <unistd.h> 38#include <unistd.h>
38#include <fcntl.h> 39#include <fcntl.h>
39 40
40#ifdef HAVE_SYS_IOCTL_H 41#ifdef HAVE_SYS_IOCTL_H
41# include <sys/ioctl.h> 42# include <sys/ioctl.h>
42#endif 43#endif
43#if defined(HAVE_DEV_PTMX) && defined(HAVE_SYS_STROPTS_H) 44#if defined(HAVE_DEV_PTMX) && defined(HAVE_SYS_STROPTS_H)
44# include <sys/stropts.h> /* for I_PUSH */ 45# include <sys/stropts.h> /* for I_PUSH */
45#endif 46#endif
46#ifdef HAVE_ISASTREAM 47#if defined(HAVE_ISASTREAM) && defined(HAVE_STROPTS_H)
47# include <stropts.h> 48# include <stropts.h>
48#endif 49#endif
49#if defined(HAVE_PTY_H) 50#if defined(HAVE_PTY_H)
50# include <pty.h> 51# include <pty.h>
51#elif defined(HAVE_LIBUTIL_H) 52#elif defined(HAVE_LIBUTIL_H)
127 int pfd; 128 int pfd;
128 char *slave; 129 char *slave;
129 130
130 slave = _getpty (&pfd, O_RDWR | O_NONBLOCK | O_NOCTTY, 0622, 0); 131 slave = _getpty (&pfd, O_RDWR | O_NONBLOCK | O_NOCTTY, 0622, 0);
131 132
132 if (slave != NULL) { 133 if (slave != NULL)
133 *ttydev = strdup (slave);
134 return pfd;
135 }
136
137 return -1;
138 }
139
140#elif defined(HAVE_DEV_PTC)
141
142 static int
143 get_pty (int *fd_tty, char **ttydev)
144 {
145 int pfd;
146
147 if ((pfd = open ("/dev/ptc", O_RDWR | O_NOCTTY, 0)) >= 0)
148 { 134 {
149 *ttydev = strdup (ttyname (pfd));
150 return pfd;
151 }
152
153 return -1;
154 }
155
156#elif defined(HAVE_DEV_CLONE)
157
158 static int
159 get_pty (int *fd_tty, char **ttydev)
160 {
161 int pfd;
162
163 if ((pfd = open ("/dev/ptym/clone", O_RDWR | O_NOCTTY, 0)) >= 0)
164 {
165 *ttydev = strdup (ptsname (pfd)); 135 *ttydev = strdup (slave);
166 return pfd; 136 return pfd;
167 } 137 }
168 138
169 return -1; 139 return -1;
170 } 140 }
246 * documentation is really unclear about whether it is any close () on 216 * documentation is really unclear about whether it is any close () on
247 * the master side or the last close () - i.e. a proper STREAMS dismantling 217 * the master side or the last close () - i.e. a proper STREAMS dismantling
248 * close () - on the master side which causes a hang up to be sent 218 * close () - on the master side which causes a hang up to be sent
249 * through - Geoff Wing 219 * through - Geoff Wing
250 */ 220 */
251# ifdef HAVE_ISASTREAM 221#if defined(HAVE_ISASTREAM) && defined(HAVE_STROPTS_H)
252 if (isastream (fd_tty) == 1) 222 if (isastream (fd_tty) == 1)
253# endif 223# endif
254 { 224 {
255 ioctl (fd_tty, I_PUSH, "ptem"); 225 ioctl (fd_tty, I_PUSH, "ptem");
256 ioctl (fd_tty, I_PUSH, "ldterm"); 226 ioctl (fd_tty, I_PUSH, "ldterm");

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines