added PDX constant
[unix-history] / usr / src / usr.bin / tip / tip.h
CommitLineData
c731dacc 1/* tip.h 4.6 81/12/16 */
11adac90
BJ
2/*
3 * tip - terminal interface program
4 *
5 * Samuel J. Leffler
6 */
7
8#include <sgtty.h>
9#include <signal.h>
10#include <stdio.h>
11#include <pwd.h>
12#include <sys/types.h>
c731dacc 13#include <ctype.h>
11adac90
BJ
14
15/*
16 * Remote host attributes
17 */
18char *DV; /* UNIX device(s) to open */
19char *EL; /* chars marking an EOL */
20char *CM; /* initial connection message */
21char *IE; /* EOT to expect on input */
22char *OE; /* EOT to send to complete FT */
23char *CU; /* call unit if making a phone call */
24char *AT; /* acu type */
25char *PN; /* phone number(s) */
26
27char *PH; /* phone number file */
28char *RM; /* remote file name */
29char *HO; /* host name */
30
31int BR; /* line speed for conversation */
32int FS; /* frame size for transfers */
33
34char DU; /* this host is dialed up */
f0211bf2 35char HW; /* this device is hardwired, see hunt.c */
11adac90
BJ
36
37/*
38 * String value table
39 */
40typedef
41 struct {
42 char *v_name; /* whose name is it */
43 char v_type; /* for interpreting set's */
44 char v_access; /* protection of touchy ones */
45 char *v_abrev; /* possible abreviation */
46 char *v_value; /* casted to a union later */
47 }
48 value_t;
49
50#define STRING 01 /* string valued */
51#define BOOL 02 /* true-false value */
52#define NUMBER 04 /* numeric value */
53#define CHAR 010 /* character value */
54
55#define WRITE 01 /* write access to variable */
56#define READ 02 /* read access */
57
58#define CHANGED 01 /* low bit is used to show modification */
59#define PUBLIC 1 /* public access rights */
60#define PRIVATE 03 /* private to definer */
61#define ROOT 05 /* root defined */
62
63#define TRUE 1
64#define FALSE 0
65
66#define ENVIRON 020 /* initialize out of the environment */
67#define IREMOTE 040 /* initialize out of remote structure */
68#define INIT 0100 /* static data space used for initialization */
69#define TMASK 017
70
71/*
72 * Definition of ACU line description
73 */
74typedef
75 struct {
76 char *acu_name;
77 int (*acu_dialer)();
78 int (*acu_disconnect)();
79 int (*acu_abort)();
80 }
81 acu_t;
82
83#define equal(a, b) (strcmp(a,b)==0)/* A nice function to string compare */
11adac90
BJ
84#define CTRL(c) ('c'&037)
85
86/*
87 * variable manipulation stuff --
88 * if we defined the value entry in value_t, then we couldn't
89 * initialize it in vars.c, so we cast it as needed to keep lint
90 * happy.
91 */
92typedef
93 union {
94 int zz_number;
95 short zz_boolean;
96 char zz_character;
97 int *zz_address;
98 }
99 zzhack;
100
101#define value(v) vtable[v].v_value
102
103#define boolean(v) ((((zzhack *)(&(v))))->zz_boolean)
104#define number(v) ((((zzhack *)(&(v))))->zz_number)
105#define character(v) ((((zzhack *)(&(v))))->zz_character)
106#define address(v) ((((zzhack *)(&(v))))->zz_address)
107
108/*
109 * Escape command table definitions --
110 * lookup in this table is performed when ``escapec'' is recognized
111 * at the begining of a line (as defined by the eolmarks variable).
112*/
113
114typedef
115 struct {
116 char e_char; /* char to match on */
117 char e_flags; /* experimental, priviledged */
118 char *e_help; /* help string */
119 int (*e_func)(); /* command */
120 }
121 esctable_t;
122
123#define NORM 00 /* normal protection, execute anyone */
124#define EXP 01 /* experimental, mark it with a `*' on help */
125#define PRIV 02 /* priviledged, root execute only */
126
127extern int vflag; /* verbose during reading of .tiprc file */
128extern value_t vtable[]; /* variable table */
129
130#ifndef ACULOG
131#define logent(a, b, c, d)
132#define loginit()
133#endif
134
135/*
136 * Definition of indices into variable table so
137 * value(DEFINE) turns into a static address.
138 */
139
140#define BEAUTIFY 0
141#define BAUDRATE 1
142#define DIALTIMEOUT 2
143#define EOFREAD 3
144#define EOFWRITE 4
145#define EOL 5
146#define ESCAPE 6
147#define EXCEPTIONS 7
148#define FORCE 8
149#define FRAMESIZE 9
150#define HOST 10
151#if ACULOG
152#define LOCK 11
153#define LOG 12
154#define PHONES 13
155#define PROMPT 14
156#define RAISE 15
157#define RAISECHAR 16
158#define RECORD 17
159#define REMOTE 18
160#define SCRIPT 19
161#define TABEXPAND 20
162#define VERBOSE 21
163#define SHELL 22
164#define HOME 23
a2c6551c 165#define ECHOCHECK 24
11adac90
BJ
166#else
167#define PHONES 11
168#define PROMPT 12
169#define RAISE 13
170#define RAISECHAR 14
171#define RECORD 15
172#define REMOTE 16
173#define SCRIPT 17
174#define TABEXPAND 18
175#define VERBOSE 19
176#define SHELL 20
177#define HOME 21
a2c6551c 178#define ECHOCHECK 22
11adac90
BJ
179#endif
180
181#define NOVAL ((value_t *)NULL)
182#define NOACU ((acu_t *)NULL)
183#define NOSTR ((char *)NULL)
184#define NOFILE ((FILE *)NULL)
185#define NOPWD ((struct passwd *)0)
186
187struct sgttyb arg; /* current mode of local terminal */
188struct sgttyb defarg; /* initial mode of local terminal */
189struct tchars tchars; /* current state of terminal */
190struct tchars defchars; /* initial state of terminal */
191
192FILE *fscript; /* FILE for scripting */
193
194int fildes[2]; /* file transfer synchronization channel */
195int repdes[2]; /* read process sychronization channel */
196int FD; /* open file descriptor to remote host */
197int vflag; /* print .tiprc initialization sequence */
198int sfd; /* for ~< operation */
199int pid; /* pid of tipout */
200int stop; /* stop transfer session flag */
201int quit; /* same; but on other end */
202int intflag; /* recognized interrupt */
203int stoprompt; /* for interrupting a prompt session */
204int timedout; /* ~> transfer timedout */
257b33f8 205int cumode; /* simulating the "cu" program */
11adac90
BJ
206
207char fname[80]; /* file name buffer for ~< */
208char copyname[80]; /* file name buffer for ~> */
209char ccc; /* synchronization character */
210char ch; /* for tipout */
211char *uucplock; /* name of lock file for uucp's */
212
213/*
214 * From <sys/tty.h> (PDP-11 V7) ... it's put in here to avoid lots
215 * of naming conflicts with stuff we have to pull in to use tty.h
216 */
217#ifndef TIOCFLUSH
218# define TIOCFLUSH (('t'<<8)|16)
219#endif
220
221/*
222 * On PDP-11 V7 systems with Rand's capacity call use this
223 * stuff, otherwise <assuming it's a VM system> use FIONREAD
224 */
225#ifndef FIONREAD
226#define FIOCAPACITY (('f'<<8)|3)
227
228struct capacity {
229 off_t cp_nbytes;
230 char cp_eof;
231};
232#endif
233
234#ifdef VMUNIX
235int odisc; /* initial tty line discipline */
4b675d70 236extern int disc; /* current tty discpline */
11adac90
BJ
237#endif
238
239extern char *ctrl();
240extern char *ctime();
241extern long time();
242extern struct passwd *getpwuid();
243extern char *getlogin();
244extern char *vinterp();
245extern char *getenv();
246extern char *rindex();
247extern char *index();
248extern char *malloc();
249extern char *connect();