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