--- rxvt-unicode/src/ptytty.h 2006/01/17 10:59:32 1.8 +++ rxvt-unicode/src/ptytty.h 2006/01/23 12:05:12 1.21 @@ -1,23 +1,26 @@ +// This file is part of libptytty. Do not make local modifications. +// http://software.schmorp.de/pkg/libptytty + #ifndef PTYTTY_H #define PTYTTY_H -#include "feature.h" +#include "libptytty.h" +#include "ptytty_conf.h" -#if defined(HAVE_GRANTPT) && defined(HAVE_UNLOCKPT) -# if defined(PTYS_ARE_GETPT) || defined(PTYS_ARE_POSIX) || defined(PTYS_ARE_PTMX) -# define NO_SETOWNER_TTYDEV 1 -# endif +#if PTYTTY_REENTRANT +# define PTYTTY_NO_PID_CHECK 1 #endif -#if defined(__CYGWIN32__) + +#if defined(HAVE__GETPTY) || defined(HAVE_OPENPTY) || defined(UNIX98_PTY) # define NO_SETOWNER_TTYDEV 1 #endif #if UTMP_SUPPORT -# if !defined(RXVT_UTMPX_FILE) || !defined(HAVE_STRUCT_UTMPX) +# if !defined(UTMPX_FILE) || !defined(HAVE_STRUCT_UTMPX) || defined(__GLIBC__) # undef HAVE_UTMPX_H # undef HAVE_STRUCT_UTMPX # endif -# if !defined(RXVT_UTMP_FILE) || !defined(HAVE_STRUCT_UTMP) +# if !defined(UTMP_FILE) || !defined(HAVE_STRUCT_UTMP) # undef HAVE_UTMP_H # undef HAVE_STRUCT_UTMP # endif @@ -39,7 +42,7 @@ # include -# ifdef RXVT_UTMP_SYSV +# ifdef UTMP_SYSV # ifndef USER_PROCESS # define USER_PROCESS 7 # endif @@ -48,50 +51,23 @@ # endif # endif -# ifdef __QNX__ -# include -# define ut_name ut_user -# endif - #endif -enum rxvt_privaction { IGNORE = 'i', SAVE = 's', RESTORE = 'r' }; - -struct rxvt_ptytty { - int pty; // pty file descriptor; connected to rxvt - int tty; // tty file descriptor; connected to child - - virtual ~rxvt_ptytty () - { - // - } - - virtual bool get () = 0; - virtual void put () = 0; - - virtual void login (int cmd_pid, bool login_shell, const char *hostname) = 0; - virtual void logout () = 0; - - void close_tty (); - - bool make_controlling_tty (); - void set_utf8_mode (bool on); -}; +#define fatal(msg) do { write (2, msg, sizeof (msg) - 1); _exit (255); } while (0) -struct rxvt_ptytty_unix : rxvt_ptytty { +struct ptytty_unix : ptytty +{ char *name; -#ifndef RESET_TTY_TO_COMMON_DEFAULTS - struct stat savestat; /* original status of our tty */ -#endif -#ifndef NO_SETOWNER_TTYDEV - void privileges (rxvt_privaction action); - bool saved; -#endif public: - rxvt_ptytty_unix (); - ~rxvt_ptytty_unix (); + ptytty_unix (); + ~ptytty_unix (); + + bool get (); + void put (); + + void login (int cmd_pid, bool login_shell, const char *hostname); #if UTMP_SUPPORT int utmp_pos; @@ -108,10 +84,6 @@ char ut_id[5]; #endif - bool get (); - void put (); - - void login (int cmd_pid, bool login_shell, const char *hostname); void logout (); #endif };