… | |
… | |
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 | * ------------------------------------------------------------------------- */ |
… | |
… | |
225 | control_tty (int fd_tty) |
227 | control_tty (int fd_tty) |
226 | { |
228 | { |
227 | int fd; |
229 | int fd; |
228 | |
230 | |
229 | /* ---------------------------------------- */ |
231 | /* ---------------------------------------- */ |
230 | # ifdef HAVE_SETSID |
|
|
231 | setsid (); |
232 | setsid (); |
232 | # endif |
|
|
233 | # if defined(HAVE_SETPGID) |
|
|
234 | setpgid (0, 0); |
|
|
235 | # elif defined(HAVE_SETPGRP) |
|
|
236 | setpgrp (0, 0); |
|
|
237 | # endif |
|
|
238 | |
|
|
239 | /* ---------------------------------------- */ |
|
|
240 | # ifdef TIOCNOTTY |
|
|
241 | fd = open ("/dev/tty", O_RDWR | O_NOCTTY); |
|
|
242 | if (fd >= 0) |
|
|
243 | { |
|
|
244 | ioctl (fd, TIOCNOTTY, NULL); /* void tty associations */ |
|
|
245 | close (fd); |
|
|
246 | } |
|
|
247 | # endif |
|
|
248 | |
|
|
249 | /* ---------------------------------------- */ |
|
|
250 | fd = open ("/dev/tty", O_RDWR | O_NOCTTY); |
|
|
251 | if (fd >= 0) |
|
|
252 | close (fd); /* ouch: still have controlling tty */ |
|
|
253 | |
233 | |
254 | /* ---------------------------------------- */ |
234 | /* ---------------------------------------- */ |
255 | # if defined(PTYS_ARE_PTMX) && defined(I_PUSH) |
235 | # if defined(PTYS_ARE_PTMX) && defined(I_PUSH) |
256 | /* |
236 | /* |
257 | * Push STREAMS modules: |
237 | * Push STREAMS modules: |
… | |
… | |
463 | } |
443 | } |
464 | |
444 | |
465 | return true; |
445 | return true; |
466 | } |
446 | } |
467 | |
447 | |
|
|
448 | // a "factory" *g* |
|
|
449 | rxvt_ptytty *rxvt_new_ptytty () |
|
|
450 | { |
|
|
451 | return new rxvt_ptytty_unix; |
|
|
452 | } |
|
|
453 | |
468 | /*----------------------- end-of-file (C source) -----------------------*/ |
454 | /*----------------------- end-of-file (C source) -----------------------*/ |
469 | |
455 | |