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.36 by root, Tue Jan 17 10:59:32 2006 UTC vs.
Revision 1.39 by root, Tue Jan 17 12:22:59 2006 UTC

54#endif 54#endif
55 55
56#include <cstdio> 56#include <cstdio>
57#include <grp.h> 57#include <grp.h>
58 58
59#include "ptytty.h"
60
59///////////////////////////////////////////////////////////////////////////// 61/////////////////////////////////////////////////////////////////////////////
60 62
61/* ------------------------------------------------------------------------- * 63/* ------------------------------------------------------------------------- *
62 * GET PSEUDO TELETYPE - MASTER AND SLAVE * 64 * GET PSEUDO TELETYPE - MASTER AND SLAVE *
63 * ------------------------------------------------------------------------- */ 65 * ------------------------------------------------------------------------- */
222 * Make our tty a controlling tty so that /dev/tty points to us 224 * Make our tty a controlling tty so that /dev/tty points to us
223 */ 225 */
224static int 226static int
225control_tty (int fd_tty) 227control_tty (int fd_tty)
226{ 228{
227#ifndef __QNX__
228 int fd; 229 int fd;
229 230
230 /* ---------------------------------------- */ 231 /* ---------------------------------------- */
231# ifdef HAVE_SETSID
232 setsid (); 232 setsid ();
233# endif
234# if defined(HAVE_SETPGID)
235 setpgid (0, 0);
236# elif defined(HAVE_SETPGRP)
237 setpgrp (0, 0);
238# endif
239
240 /* ---------------------------------------- */
241# ifdef TIOCNOTTY
242 fd = open ("/dev/tty", O_RDWR | O_NOCTTY);
243 if (fd >= 0)
244 {
245 ioctl (fd, TIOCNOTTY, NULL); /* void tty associations */
246 close (fd);
247 }
248# endif
249
250 /* ---------------------------------------- */
251 fd = open ("/dev/tty", O_RDWR | O_NOCTTY);
252 if (fd >= 0)
253 close (fd); /* ouch: still have controlling tty */
254 233
255 /* ---------------------------------------- */ 234 /* ---------------------------------------- */
256# if defined(PTYS_ARE_PTMX) && defined(I_PUSH) 235# if defined(PTYS_ARE_PTMX) && defined(I_PUSH)
257 /* 236 /*
258 * Push STREAMS modules: 237 * Push STREAMS modules:
286 fd = open ("/dev/tty", O_WRONLY); 265 fd = open ("/dev/tty", O_WRONLY);
287 if (fd < 0) 266 if (fd < 0)
288 return -1; /* fatal */ 267 return -1; /* fatal */
289 close (fd); 268 close (fd);
290 /* ---------------------------------------- */ 269 /* ---------------------------------------- */
291#endif /* ! __QNX__ */
292 270
293 return 0; 271 return 0;
294} 272}
295 273
296void 274void
465 } 443 }
466 444
467 return true; 445 return true;
468} 446}
469 447
448// a "factory" *g*
449rxvt_ptytty *rxvt_new_ptytty ()
450{
451 return new rxvt_ptytty_unix;
452}
453
470/*----------------------- end-of-file (C source) -----------------------*/ 454/*----------------------- end-of-file (C source) -----------------------*/
471 455

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines