--- rxvt-unicode/src/ptytty.h 2004/08/15 02:35:27 1.2 +++ rxvt-unicode/src/ptytty.h 2006/01/22 04:01:52 1.20 @@ -1,29 +1,87 @@ +// This file is part of libptytty. Do not make local modifications. +// http://software.schmorp.de/pkg/libptytty + #ifndef PTYTTY_H #define PTYTTY_H -#include "rxvt.h" +#include "libptytty.h" +#include "ptytty_conf.h" + +#if defined(HAVE__GETPTY) || defined(HAVE_OPENPTY) || defined(UNIX98_PTY) +# define NO_SETOWNER_TTYDEV 1 +#endif -enum rxvt_privaction { IGNORE = 'i', SAVE = 's', RESTORE = 'r' }; +#if UTMP_SUPPORT +# if !defined(UTMPX_FILE) || !defined(HAVE_STRUCT_UTMPX) || defined(__GLIBC__) +# undef HAVE_UTMPX_H +# undef HAVE_STRUCT_UTMPX +# endif +# if !defined(UTMP_FILE) || !defined(HAVE_STRUCT_UTMP) +# undef HAVE_UTMP_H +# undef HAVE_STRUCT_UTMP +# endif + +# ifdef HAVE_UTMPX_H +# include +# endif +# ifdef HAVE_UTMP_H +# include +# endif + +# if ! defined(HAVE_STRUCT_UTMPX) && ! defined(HAVE_STRUCT_UTMP) +# error cannot build with utmp support - no utmp or utmpx struct found +# endif + +# ifdef HAVE_LASTLOG_H +# include +# endif + +# include + +# ifdef UTMP_SYSV +# ifndef USER_PROCESS +# define USER_PROCESS 7 +# endif +# ifndef DEAD_PROCESS +# define DEAD_PROCESS 8 +# endif +# endif -struct rxvt_ptytty { -#ifndef RESET_TTY_TO_COMMON_DEFAULTS - struct stat savestat; /* original status of our tty */ #endif - void privileges (rxvt_privaction action); -public: - int pty; // pty file descriptor; connected to rxvt - int tty; // tty file descriptor; connected to child + +#define fatal(msg) do { write (2, msg, sizeof (msg) - 1); _exit (255); } while (0) + +struct ptytty_unix : ptytty +{ char *name; - rxvt_ptytty (); - ~rxvt_ptytty (); +public: + + ptytty_unix (); + ~ptytty_unix (); bool get (); void put (); - void close_tty (); + void login (int cmd_pid, bool login_shell, const char *hostname); + +#if UTMP_SUPPORT + int utmp_pos; + int cmd_pid; + bool login_shell; - bool make_controlling_tty (); +#ifdef HAVE_STRUCT_UTMP + struct utmp ut; +#endif +#ifdef HAVE_STRUCT_UTMPX + struct utmpx utx; +#endif +#if (defined(HAVE_STRUCT_UTMP) && defined(HAVE_UTMP_PID)) || defined(HAVE_STRUCT_UTMPX) + char ut_id[5]; +#endif + + void logout (); +#endif }; #endif