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.16 by root, Sun Aug 15 03:30:04 2004 UTC vs.
Revision 1.23 by root, Thu Feb 17 15:07:48 2005 UTC

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#if defined( __FreeBSD__)
53// better do this via configure, but.... 55// better do this via configure, but....
56#if defined(__FreeBSD__)
54# include <libutil.h> 57# include <libutil.h>
58#elif defined(__DARWIN__) || (defined (__MACH__) && defined (__APPLE__))
59# include <util.h>
55#endif 60#endif
56 61
57#include <cstdio> 62#include <cstdio>
58#include <grp.h> 63#include <grp.h>
59 64
329} ttyconf; 334} ttyconf;
330 335
331void 336void
332rxvt_ptytty::privileges (rxvt_privaction action) 337rxvt_ptytty::privileges (rxvt_privaction action)
333{ 338{
339 if (tty < 0)
340 return;
341
334 rxvt_privileges (RESTORE); 342 rxvt_privileges (RESTORE);
335 343
336 if (action == SAVE) 344 if (action == SAVE)
337 { 345 {
338 //next_tty_action = RESTORE; 346 //next_tty_action = RESTORE;
340 /* 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 */
341 if (lstat (name, &savestat) < 0) /* you lose out */ 349 if (lstat (name, &savestat) < 0) /* you lose out */
342 ;//next_tty_action = IGNORE; 350 ;//next_tty_action = IGNORE;
343 else 351 else
344# endif 352# endif
345
346 { 353 {
347 chown (name, getuid (), ttyconf.gid); /* fail silently */ 354 chown (name, getuid (), ttyconf.gid); /* fail silently */
348 chmod (name, ttyconf.mode); 355 chmod (name, ttyconf.mode);
349# ifdef HAVE_REVOKE 356# ifdef HAVE_REVOKE
350 revoke (name); 357 revoke (name);
351# endif 358# endif
352
353 } 359 }
354 } 360 }
355 else 361 else
356 { /* action == RESTORE */ 362 { /* action == RESTORE */
357 //next_tty_action = IGNORE; 363 //next_tty_action = IGNORE;
434 } 440 }
435 441
436 return true; 442 return true;
437} 443}
438 444
445void
446rxvt_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
439/*----------------------- end-of-file (C source) -----------------------*/ 472/*----------------------- end-of-file (C source) -----------------------*/
440 473

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines