Revision: | 1.21 |
Committed: | Mon Jan 23 12:05:12 2006 UTC (18 years, 5 months ago) by root |
Content type: | text/plain |
Branch: | MAIN |
CVS Tags: | rel-7_3, before_dynamic_fontidx, rel-7_6, rel-7_5, rel-9_0, rel-7_9, rel-7_8, rel-7_7, rel-7_4, rel-8_5a, rel-7_3a, rel-8_9, rel-8_8, dynamic_fontidx, rel-8_0, rel-8_1, rel-8_2, rel-8_3, rel-8_4, rel-8_6, rel-8_7, rel-9_02, rel-9_01, rel-9_06, rel-9_07, rel-9_05 |
Changes since 1.20: | +4 -0 lines |
Log Message: | *** empty log message *** |
# | Content |
---|---|
1 | // This file is part of libptytty. Do not make local modifications. |
2 | // http://software.schmorp.de/pkg/libptytty |
3 | |
4 | #ifndef PTYTTY_H |
5 | #define PTYTTY_H |
6 | |
7 | #include "libptytty.h" |
8 | #include "ptytty_conf.h" |
9 | |
10 | #if PTYTTY_REENTRANT |
11 | # define PTYTTY_NO_PID_CHECK 1 |
12 | #endif |
13 | |
14 | #if defined(HAVE__GETPTY) || defined(HAVE_OPENPTY) || defined(UNIX98_PTY) |
15 | # define NO_SETOWNER_TTYDEV 1 |
16 | #endif |
17 | |
18 | #if UTMP_SUPPORT |
19 | # if !defined(UTMPX_FILE) || !defined(HAVE_STRUCT_UTMPX) || defined(__GLIBC__) |
20 | # undef HAVE_UTMPX_H |
21 | # undef HAVE_STRUCT_UTMPX |
22 | # endif |
23 | # if !defined(UTMP_FILE) || !defined(HAVE_STRUCT_UTMP) |
24 | # undef HAVE_UTMP_H |
25 | # undef HAVE_STRUCT_UTMP |
26 | # endif |
27 | |
28 | # ifdef HAVE_UTMPX_H |
29 | # include <utmpx.h> |
30 | # endif |
31 | # ifdef HAVE_UTMP_H |
32 | # include <utmp.h> |
33 | # endif |
34 | |
35 | # if ! defined(HAVE_STRUCT_UTMPX) && ! defined(HAVE_STRUCT_UTMP) |
36 | # error cannot build with utmp support - no utmp or utmpx struct found |
37 | # endif |
38 | |
39 | # ifdef HAVE_LASTLOG_H |
40 | # include <lastlog.h> |
41 | # endif |
42 | |
43 | # include <pwd.h> |
44 | |
45 | # ifdef UTMP_SYSV |
46 | # ifndef USER_PROCESS |
47 | # define USER_PROCESS 7 |
48 | # endif |
49 | # ifndef DEAD_PROCESS |
50 | # define DEAD_PROCESS 8 |
51 | # endif |
52 | # endif |
53 | |
54 | #endif |
55 | |
56 | #define fatal(msg) do { write (2, msg, sizeof (msg) - 1); _exit (255); } while (0) |
57 | |
58 | struct ptytty_unix : ptytty |
59 | { |
60 | char *name; |
61 | |
62 | public: |
63 | |
64 | ptytty_unix (); |
65 | ~ptytty_unix (); |
66 | |
67 | bool get (); |
68 | void put (); |
69 | |
70 | void login (int cmd_pid, bool login_shell, const char *hostname); |
71 | |
72 | #if UTMP_SUPPORT |
73 | int utmp_pos; |
74 | int cmd_pid; |
75 | bool login_shell; |
76 | |
77 | #ifdef HAVE_STRUCT_UTMP |
78 | struct utmp ut; |
79 | #endif |
80 | #ifdef HAVE_STRUCT_UTMPX |
81 | struct utmpx utx; |
82 | #endif |
83 | #if (defined(HAVE_STRUCT_UTMP) && defined(HAVE_UTMP_PID)) || defined(HAVE_STRUCT_UTMPX) |
84 | char ut_id[5]; |
85 | #endif |
86 | |
87 | void logout (); |
88 | #endif |
89 | }; |
90 | |
91 | #endif |
92 |