[20080] | 1 | /* C K U P T Y . H -- Includes and definitions for ckupty.c */ |
---|
| 2 | |
---|
| 3 | /* |
---|
| 4 | Copyright 1995 by the Massachusetts Institute of Technology. |
---|
| 5 | |
---|
| 6 | Modified for use in C-Kermit by: |
---|
| 7 | |
---|
| 8 | Jeffrey Altman <jaltman@columbia.edu> |
---|
| 9 | The Kermit Project, Columbia University, New York City |
---|
| 10 | November 1999 |
---|
| 11 | */ |
---|
| 12 | #ifndef __PTY_INT_H__ |
---|
| 13 | #include <sys/types.h> |
---|
| 14 | |
---|
| 15 | /* #define WANT_UTMP */ |
---|
| 16 | /* We don't want all the utmp/wtmp stuff */ |
---|
| 17 | |
---|
| 18 | #ifdef WANT_UTMP |
---|
| 19 | #ifdef HAVE_UTMP_H |
---|
| 20 | #include <utmp.h> |
---|
| 21 | #endif /* HAVE_UTMP_H */ |
---|
| 22 | #ifdef HAVE_UTMPX_H |
---|
| 23 | #include <utmpx.h> |
---|
| 24 | #endif /* HAVE_UTMPX_H */ |
---|
| 25 | #endif /* WANT_UTMP */ |
---|
| 26 | |
---|
| 27 | #ifdef HAVE_UNISTD_H |
---|
| 28 | #include <unistd.h> |
---|
| 29 | #endif /* HAVE_UNISTD_H */ |
---|
| 30 | #ifdef __SCO__ |
---|
| 31 | #include <sys/unistd.h> |
---|
| 32 | #endif /* __SCO__ */ |
---|
| 33 | #ifdef HAVE_STDLIB_H |
---|
| 34 | #include <stdlib.h> |
---|
| 35 | #endif /* HAVE_STDLIB_H */ |
---|
| 36 | |
---|
| 37 | #include <stdio.h> |
---|
| 38 | |
---|
| 39 | #include <sys/stat.h> |
---|
| 40 | #include <sys/ioctl.h> |
---|
| 41 | #include <sys/file.h> |
---|
| 42 | #include <sys/time.h> |
---|
| 43 | #include <ctype.h> |
---|
| 44 | #include <fcntl.h> |
---|
| 45 | #include <netinet/in.h> |
---|
| 46 | #include <errno.h> |
---|
| 47 | #include <pwd.h> |
---|
| 48 | |
---|
| 49 | #ifdef HAVE_SYS_LABEL_H |
---|
| 50 | /* only SunOS 4? */ |
---|
| 51 | #include <sys/label.h> |
---|
| 52 | #include <sys/audit.h> |
---|
| 53 | #include <pwdadj.h> |
---|
| 54 | #endif /* HAVE_SYS_LABEL_H */ |
---|
| 55 | |
---|
| 56 | #include <signal.h> |
---|
| 57 | |
---|
| 58 | #ifdef HPUX |
---|
| 59 | #include <sys/ptyio.h> |
---|
| 60 | #endif /* HPUX */ |
---|
| 61 | #ifdef sysvimp |
---|
| 62 | #include <compat.h> |
---|
| 63 | #endif /* sysvimp */ |
---|
| 64 | |
---|
| 65 | #ifdef COMMENT |
---|
| 66 | /* I don't think we actually use this for anything */ |
---|
| 67 | /* and it kills Slackware builds, where there is no select.h. */ |
---|
| 68 | #ifndef NO_SYS_SELECT_H |
---|
| 69 | #ifdef HAVE_SYS_SELECT_H |
---|
| 70 | #include <sys/select.h> |
---|
| 71 | #endif /* HAVE_SYS_SELECT_H */ |
---|
| 72 | #endif /* NO_SYS_SELECT_H */ |
---|
| 73 | #endif /* COMMENT */ |
---|
| 74 | |
---|
| 75 | #ifdef HAVE_STREAMS |
---|
| 76 | #include <sys/stream.h> |
---|
| 77 | #include <sys/stropts.h> |
---|
| 78 | #endif /* HAVE_STREAMS */ |
---|
| 79 | |
---|
| 80 | #ifdef POSIX_TERMIOS |
---|
| 81 | #ifndef ultrix |
---|
| 82 | #include <termios.h> |
---|
| 83 | #else |
---|
| 84 | #include <sgtty.h> |
---|
| 85 | #endif /* ultrix */ |
---|
| 86 | #else /* POSIX_TERMIOS */ |
---|
| 87 | #include <sgtty.h> |
---|
| 88 | #endif /* POSIX_TERMIOS */ |
---|
| 89 | |
---|
| 90 | #include <netdb.h> |
---|
| 91 | /* #include <syslog.h> */ |
---|
| 92 | #ifndef ultrix |
---|
| 93 | #include <string.h> |
---|
| 94 | #endif /* ultrix */ |
---|
| 95 | /* #include <sys/param.h> */ /* (now done in ckcdeb.h) */ |
---|
| 96 | |
---|
| 97 | #ifdef HAVE_STREAMS |
---|
| 98 | /* krlogin doesn't test sys/tty... */ |
---|
| 99 | #ifdef HAVE_SYS_TTY_H |
---|
| 100 | #include <sys/tty.h> |
---|
| 101 | #endif /* HAVE_SYS_TTY_H */ |
---|
| 102 | |
---|
| 103 | #ifdef HAVE_SYS_PTYVAR_H |
---|
| 104 | /* Solaris actually uses packet mode, so the real macros are needed too */ |
---|
| 105 | #include <sys/ptyvar.h> |
---|
| 106 | #endif /* HAVE_SYS_PTYVAR_H */ |
---|
| 107 | #endif /* HAVE_STREAMS */ |
---|
| 108 | |
---|
| 109 | #ifdef HAVE_VHANGUP |
---|
| 110 | #ifndef OPEN_CTTY_ONLY_ONCE |
---|
| 111 | /* |
---|
| 112 | Breaks under Ultrix and others where you cannot get controlling |
---|
| 113 | terminal twice. |
---|
| 114 | */ |
---|
| 115 | #define VHANG_first |
---|
| 116 | #define VHANG_LAST |
---|
| 117 | #endif /* OPEN_CTTY_ONLY_ONCE */ |
---|
| 118 | #endif /* HAVE_VHANGUP */ |
---|
| 119 | |
---|
| 120 | /* Internal functions */ |
---|
| 121 | _PROTOTYP(long ptyint_void_association,(void)); |
---|
| 122 | _PROTOTYP(long ptyint_open_ctty ,(char *, int *)); |
---|
| 123 | _PROTOTYP(VOID ptyint_vhangup, (void)); |
---|
| 124 | |
---|
| 125 | #ifdef WANT_UTMP |
---|
| 126 | _PROTOTYP(long ptyint_update_wtmp, (struct utmp *, char *, char *)); |
---|
| 127 | #endif /* WANT_UTMP */ |
---|
| 128 | |
---|
| 129 | #define __PTY_INT_H__ |
---|
| 130 | #endif /* __PTY_INT_H__ */ |
---|
| 131 | |
---|
| 132 | #ifndef __LIBPTY_H__ |
---|
| 133 | |
---|
| 134 | #ifdef WANT_UTMP |
---|
| 135 | /* Constants for pty_update_utmp */ |
---|
| 136 | #define PTY_LOGIN_PROCESS 0 |
---|
| 137 | #define PTY_USER_PROCESS 1 |
---|
| 138 | #define PTY_DEAD_PROCESS 2 |
---|
| 139 | #define PTY_TTYSLOT_USABLE (0x1) /* flags to update_utmp*/ |
---|
| 140 | #define PTY_UTMP_USERNAME_VALID (0x2) |
---|
| 141 | #endif /* WANT_UTMP */ |
---|
| 142 | |
---|
| 143 | _PROTOTYP(long pty_init,(void)); |
---|
| 144 | _PROTOTYP(long pty_getpty, ( int *, char *, int)); |
---|
| 145 | _PROTOTYP(long pty_open_slave, (char *, int *)); |
---|
| 146 | _PROTOTYP(long pty_open_ctty, (char *, int *)); |
---|
| 147 | _PROTOTYP(long pty_initialize_slave, (int)); |
---|
| 148 | #ifdef WANT_UTMP |
---|
| 149 | _PROTOTYP(long pty_update_utmp, (int, int, char *, char *, char *, int)); |
---|
| 150 | _PROTOTYP(long pty_logwtmp, (char *, char *, char *)); |
---|
| 151 | #endif /* WANT_UTMP */ |
---|
| 152 | _PROTOTYP(long pty_cleanup, (char *, int, int)); |
---|
| 153 | |
---|
| 154 | #define PTY_GETPTY_STREAMS (44806912L) |
---|
| 155 | #define PTY_GETPTY_FSTAT (44806913L) |
---|
| 156 | #define PTY_GETPTY_NOPTY (44806914L) |
---|
| 157 | #define PTY_GETPTY_SLAVE_TOOLONG (44806915L) |
---|
| 158 | #define PTY_OPEN_SLAVE_OPENFAIL (44806916L) |
---|
| 159 | #define PTY_OPEN_SLAVE_CHMODFAIL (44806917L) |
---|
| 160 | #define PTY_OPEN_SLAVE_NOCTTY (44806918L) |
---|
| 161 | #define PTY_OPEN_SLAVE_CHOWNFAIL (44806919L) |
---|
| 162 | #define PTY_OPEN_SLAVE_LINE_PUSHFAIL (44806920L) |
---|
| 163 | #define PTY_OPEN_SLAVE_PUSH_FAIL (44806921L) |
---|
| 164 | #define PTY_OPEN_SLAVE_REVOKEFAIL (44806922L) |
---|
| 165 | #ifdef WANT_UTMP |
---|
| 166 | #define PTY_UPDATE_UTMP_PROCTYPE_INVALID (44806923L) |
---|
| 167 | #endif /* WANT_UTMP */ |
---|
| 168 | #define PTY_OPEN_SLAVE_TOOSHORT (44806924L) |
---|
| 169 | #define ERROR_TABLE_BASE_pty (44806912L) |
---|
| 170 | |
---|
| 171 | extern struct error_table et_pty_error_table; |
---|
| 172 | |
---|
| 173 | #define __LIBPTY_H__ |
---|
| 174 | #endif /* __LIBPTY_H__ */ |
---|