Now turns off local characters (suspend, etc)
[unix-history] / usr / src / usr.bin / tip / tip.h
CommitLineData
c5d1037a 1/* tip.h 4.9 83/05/17 */
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
85/*
86 * variable manipulation stuff --
87 * if we defined the value entry in value_t, then we couldn't
88 * initialize it in vars.c, so we cast it as needed to keep lint
89 * happy.
90 */
91typedef
92 union {
93 int zz_number;
96ad7152
BS
94 int zz_boolean;
95 int zz_character;
11adac90
BJ
96 int *zz_address;
97 }
98 zzhack;
99
100#define value(v) vtable[v].v_value
101
102#define boolean(v) ((((zzhack *)(&(v))))->zz_boolean)
103#define number(v) ((((zzhack *)(&(v))))->zz_number)
104#define character(v) ((((zzhack *)(&(v))))->zz_character)
105#define address(v) ((((zzhack *)(&(v))))->zz_address)
106
107/*
108 * Escape command table definitions --
109 * lookup in this table is performed when ``escapec'' is recognized
110 * at the begining of a line (as defined by the eolmarks variable).
111*/
112
113typedef
114 struct {
115 char e_char; /* char to match on */
116 char e_flags; /* experimental, priviledged */
117 char *e_help; /* help string */
118 int (*e_func)(); /* command */
119 }
120 esctable_t;
121
122#define NORM 00 /* normal protection, execute anyone */
123#define EXP 01 /* experimental, mark it with a `*' on help */
124#define PRIV 02 /* priviledged, root execute only */
125
126extern int vflag; /* verbose during reading of .tiprc file */
127extern value_t vtable[]; /* variable table */
128
129#ifndef ACULOG
130#define logent(a, b, c, d)
131#define loginit()
132#endif
133
134/*
135 * Definition of indices into variable table so
136 * value(DEFINE) turns into a static address.
137 */
138
139#define BEAUTIFY 0
140#define BAUDRATE 1
141#define DIALTIMEOUT 2
142#define EOFREAD 3
143#define EOFWRITE 4
144#define EOL 5
145#define ESCAPE 6
146#define EXCEPTIONS 7
147#define FORCE 8
148#define FRAMESIZE 9
149#define HOST 10
150#if ACULOG
151#define LOCK 11
152#define LOG 12
153#define PHONES 13
154#define PROMPT 14
155#define RAISE 15
156#define RAISECHAR 16
157#define RECORD 17
158#define REMOTE 18
159#define SCRIPT 19
160#define TABEXPAND 20
161#define VERBOSE 21
162#define SHELL 22
163#define HOME 23
a2c6551c 164#define ECHOCHECK 24
11adac90
BJ
165#else
166#define PHONES 11
167#define PROMPT 12
168#define RAISE 13
169#define RAISECHAR 14
170#define RECORD 15
171#define REMOTE 16
172#define SCRIPT 17
173#define TABEXPAND 18
174#define VERBOSE 19
175#define SHELL 20
176#define HOME 21
a2c6551c 177#define ECHOCHECK 22
11adac90
BJ
178#endif
179
180#define NOVAL ((value_t *)NULL)
181#define NOACU ((acu_t *)NULL)
182#define NOSTR ((char *)NULL)
183#define NOFILE ((FILE *)NULL)
184#define NOPWD ((struct passwd *)0)
185
186struct sgttyb arg; /* current mode of local terminal */
187struct sgttyb defarg; /* initial mode of local terminal */
188struct tchars tchars; /* current state of terminal */
189struct tchars defchars; /* initial state of terminal */
c5d1037a
BJ
190struct ltchars ltchars; /* current local characters of terminal */
191struct ltchars deflchars; /* initial local characters of terminal */
11adac90
BJ
192
193FILE *fscript; /* FILE for scripting */
194
195int fildes[2]; /* file transfer synchronization channel */
196int repdes[2]; /* read process sychronization channel */
197int FD; /* open file descriptor to remote host */
198int vflag; /* print .tiprc initialization sequence */
199int sfd; /* for ~< operation */
200int pid; /* pid of tipout */
201int stop; /* stop transfer session flag */
202int quit; /* same; but on other end */
203int intflag; /* recognized interrupt */
204int stoprompt; /* for interrupting a prompt session */
205int timedout; /* ~> transfer timedout */
257b33f8 206int cumode; /* simulating the "cu" program */
11adac90
BJ
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 */
4b675d70 237extern int disc; /* current tty discpline */
11adac90
BJ
238#endif
239
240extern char *ctrl();
241extern char *ctime();
242extern long time();
243extern struct passwd *getpwuid();
244extern char *getlogin();
245extern char *vinterp();
246extern char *getenv();
247extern char *rindex();
248extern char *index();
249extern char *malloc();
250extern char *connect();