1 | #ifndef PTYTTY_H |
1 | #ifndef PTYTTY_H |
2 | #define PTYTTY_H |
2 | #define PTYTTY_H |
3 | |
3 | |
4 | #include "rxvt.h" |
4 | #include "rxvt.h" |
|
|
5 | #include "feature.h" |
5 | |
6 | |
6 | enum rxvt_privaction { IGNORE = 'i', SAVE = 's', RESTORE = 'r' }; |
7 | #if defined(HAVE__GETPTY) || defined(HAVE_OPENPTY) || defined(UNIX98_PTY) |
|
|
8 | # define NO_SETOWNER_TTYDEV 1 |
|
|
9 | #endif |
7 | |
10 | |
8 | struct rxvt_ptytty { |
11 | #if UTMP_SUPPORT |
9 | #ifndef RESET_TTY_TO_COMMON_DEFAULTS |
12 | # if !defined(RXVT_UTMPX_FILE) || !defined(HAVE_STRUCT_UTMPX) || defined(__GLIBC__) |
10 | struct stat savestat; /* original status of our tty */ |
13 | # undef HAVE_UTMPX_H |
|
|
14 | # undef HAVE_STRUCT_UTMPX |
|
|
15 | # endif |
|
|
16 | # if !defined(RXVT_UTMP_FILE) || !defined(HAVE_STRUCT_UTMP) |
|
|
17 | # undef HAVE_UTMP_H |
|
|
18 | # undef HAVE_STRUCT_UTMP |
|
|
19 | # endif |
|
|
20 | |
|
|
21 | # ifdef HAVE_UTMPX_H |
|
|
22 | # include <utmpx.h> |
|
|
23 | # endif |
|
|
24 | # ifdef HAVE_UTMP_H |
|
|
25 | # include <utmp.h> |
|
|
26 | # endif |
|
|
27 | |
|
|
28 | # if ! defined(HAVE_STRUCT_UTMPX) && ! defined(HAVE_STRUCT_UTMP) |
|
|
29 | # error cannot build with utmp support - no utmp or utmpx struct found |
|
|
30 | # endif |
|
|
31 | |
|
|
32 | # ifdef HAVE_LASTLOG_H |
|
|
33 | # include <lastlog.h> |
|
|
34 | # endif |
|
|
35 | |
|
|
36 | # include <pwd.h> |
|
|
37 | |
|
|
38 | # ifdef RXVT_UTMP_SYSV |
|
|
39 | # ifndef USER_PROCESS |
|
|
40 | # define USER_PROCESS 7 |
|
|
41 | # endif |
|
|
42 | # ifndef DEAD_PROCESS |
|
|
43 | # define DEAD_PROCESS 8 |
|
|
44 | # endif |
|
|
45 | # endif |
|
|
46 | |
11 | #endif |
47 | #endif |
12 | void privileges (rxvt_privaction action); |
48 | |
13 | public: |
49 | struct rxvt_ptytty_unix : rxvt_ptytty |
14 | int pty; // pty file descriptor; connected to rxvt |
50 | { |
15 | int tty; // tty file descriptor; connected to child |
|
|
16 | char *name; |
51 | char *name; |
17 | |
52 | |
|
|
53 | public: |
|
|
54 | |
18 | rxvt_ptytty (); |
55 | rxvt_ptytty_unix (); |
19 | ~rxvt_ptytty (); |
56 | ~rxvt_ptytty_unix (); |
20 | |
57 | |
21 | bool get (); |
58 | bool get (); |
22 | void put (); |
59 | void put (); |
23 | |
60 | |
24 | void close_tty (); |
61 | void login (int cmd_pid, bool login_shell, const char *hostname); |
25 | |
62 | |
26 | bool make_controlling_tty (); |
63 | #if UTMP_SUPPORT |
27 | void set_utf8_mode (bool on); |
64 | int utmp_pos; |
|
|
65 | int cmd_pid; |
|
|
66 | bool login_shell; |
|
|
67 | |
|
|
68 | #ifdef HAVE_STRUCT_UTMP |
|
|
69 | struct utmp ut; |
|
|
70 | #endif |
|
|
71 | #ifdef HAVE_STRUCT_UTMPX |
|
|
72 | struct utmpx utx; |
|
|
73 | #endif |
|
|
74 | #if (defined(HAVE_STRUCT_UTMP) && defined(HAVE_UTMP_PID)) || defined(HAVE_STRUCT_UTMPX) |
|
|
75 | char ut_id[5]; |
|
|
76 | #endif |
|
|
77 | |
|
|
78 | void logout (); |
|
|
79 | #endif |
28 | }; |
80 | }; |
29 | |
81 | |
30 | #endif |
82 | #endif |
31 | |
83 | |