… | |
… | |
46 | # include <sys/stropts.h> /* for I_PUSH */ |
46 | # include <sys/stropts.h> /* for I_PUSH */ |
47 | #endif |
47 | #endif |
48 | #ifdef HAVE_ISASTREAM |
48 | #ifdef HAVE_ISASTREAM |
49 | # include <stropts.h> |
49 | # include <stropts.h> |
50 | #endif |
50 | #endif |
|
|
51 | #ifdef HAVE_PTY_H |
|
|
52 | # include <pty.h> |
|
|
53 | #endif |
51 | |
54 | |
52 | // better do this via configure, but.... |
55 | // better do this via configure, but.... |
53 | #if defined(__FreeBSD__) |
56 | #if defined(__FreeBSD__) |
54 | # include <libutil.h> |
57 | # include <libutil.h> |
55 | #elif defined(__DARWIN__) |
58 | #elif defined(__DARWIN__) || (defined (__MACH__) && defined (__APPLE__)) |
56 | # include <util.h> |
59 | # include <util.h> |
57 | #endif |
60 | #endif |
58 | |
61 | |
59 | #include <cstdio> |
62 | #include <cstdio> |
60 | #include <grp.h> |
63 | #include <grp.h> |
… | |
… | |
331 | } ttyconf; |
334 | } ttyconf; |
332 | |
335 | |
333 | void |
336 | void |
334 | rxvt_ptytty::privileges (rxvt_privaction action) |
337 | rxvt_ptytty::privileges (rxvt_privaction action) |
335 | { |
338 | { |
|
|
339 | if (tty < 0) |
|
|
340 | return; |
|
|
341 | |
336 | rxvt_privileges (RESTORE); |
342 | rxvt_privileges (RESTORE); |
337 | |
343 | |
338 | if (action == SAVE) |
344 | if (action == SAVE) |
339 | { |
345 | { |
340 | //next_tty_action = RESTORE; |
346 | //next_tty_action = RESTORE; |
… | |
… | |
342 | /* store original tty status for restoration rxvt_clean_exit () -- rgg 04/12/95 */ |
348 | /* store original tty status for restoration rxvt_clean_exit () -- rgg 04/12/95 */ |
343 | if (lstat (name, &savestat) < 0) /* you lose out */ |
349 | if (lstat (name, &savestat) < 0) /* you lose out */ |
344 | ;//next_tty_action = IGNORE; |
350 | ;//next_tty_action = IGNORE; |
345 | else |
351 | else |
346 | # endif |
352 | # endif |
347 | |
|
|
348 | { |
353 | { |
349 | chown (name, getuid (), ttyconf.gid); /* fail silently */ |
354 | chown (name, getuid (), ttyconf.gid); /* fail silently */ |
350 | chmod (name, ttyconf.mode); |
355 | chmod (name, ttyconf.mode); |
351 | # ifdef HAVE_REVOKE |
356 | # ifdef HAVE_REVOKE |
352 | revoke (name); |
357 | revoke (name); |
353 | # endif |
358 | # endif |
354 | |
|
|
355 | } |
359 | } |
356 | } |
360 | } |
357 | else |
361 | else |
358 | { /* action == RESTORE */ |
362 | { /* action == RESTORE */ |
359 | //next_tty_action = IGNORE; |
363 | //next_tty_action = IGNORE; |
… | |
… | |
436 | } |
440 | } |
437 | |
441 | |
438 | return true; |
442 | return true; |
439 | } |
443 | } |
440 | |
444 | |
|
|
445 | void |
|
|
446 | rxvt_ptytty::set_utf8_mode (bool on) |
|
|
447 | { |
|
|
448 | #ifdef IUTF8 |
|
|
449 | if (pty != -1) |
|
|
450 | { |
|
|
451 | struct termios tio; |
|
|
452 | |
|
|
453 | if (tcgetattr (pty, &tio) != -1) |
|
|
454 | { |
|
|
455 | tcflag_t new_cflag = tio.c_iflag; |
|
|
456 | |
|
|
457 | if (on) |
|
|
458 | new_cflag |= IUTF8; |
|
|
459 | else |
|
|
460 | new_cflag &= ~IUTF8; |
|
|
461 | |
|
|
462 | if (new_cflag != tio.c_iflag) |
|
|
463 | { |
|
|
464 | tio.c_iflag = new_cflag; |
|
|
465 | tcsetattr (pty, TCSANOW, &tio); |
|
|
466 | } |
|
|
467 | } |
|
|
468 | } |
|
|
469 | #endif |
|
|
470 | } |
|
|
471 | |
441 | /*----------------------- end-of-file (C source) -----------------------*/ |
472 | /*----------------------- end-of-file (C source) -----------------------*/ |
442 | |
473 | |