change over to new error message format
[unix-history] / usr / src / usr.bin / tip / tip.h
CommitLineData
a2c6551c 1/* tip.h 4.2 81/06/02 */
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 */
34
35/*
36 * String value table
37 */
38typedef
39 struct {
40 char *v_name; /* whose name is it */
41 char v_type; /* for interpreting set's */
42 char v_access; /* protection of touchy ones */
43 char *v_abrev; /* possible abreviation */
44 char *v_value; /* casted to a union later */
45 }
46 value_t;
47
48#define STRING 01 /* string valued */
49#define BOOL 02 /* true-false value */
50#define NUMBER 04 /* numeric value */
51#define CHAR 010 /* character value */
52
53#define WRITE 01 /* write access to variable */
54#define READ 02 /* read access */
55
56#define CHANGED 01 /* low bit is used to show modification */
57#define PUBLIC 1 /* public access rights */
58#define PRIVATE 03 /* private to definer */
59#define ROOT 05 /* root defined */
60
61#define TRUE 1
62#define FALSE 0
63
64#define ENVIRON 020 /* initialize out of the environment */
65#define IREMOTE 040 /* initialize out of remote structure */
66#define INIT 0100 /* static data space used for initialization */
67#define TMASK 017
68
69/*
70 * Definition of ACU line description
71 */
72typedef
73 struct {
74 char *acu_name;
75 int (*acu_dialer)();
76 int (*acu_disconnect)();
77 int (*acu_abort)();
78 }
79 acu_t;
80
81#define equal(a, b) (strcmp(a,b)==0)/* A nice function to string compare */
82#define islower(c) ((c)>='a'&&(c)<='z')
83#define toupper(c) (c)-=('a'-'A')
84#define isnum(c) ((c)>='0'&&(c)<= '9')
85#define CTRL(c) ('c'&037)
86
87/*
88 * variable manipulation stuff --
89 * if we defined the value entry in value_t, then we couldn't
90 * initialize it in vars.c, so we cast it as needed to keep lint
91 * happy.
92 */
93typedef
94 union {
95 int zz_number;
96 short zz_boolean;
97 char zz_character;
98 int *zz_address;
99 }
100 zzhack;
101
102#define value(v) vtable[v].v_value
103
104#define boolean(v) ((((zzhack *)(&(v))))->zz_boolean)
105#define number(v) ((((zzhack *)(&(v))))->zz_number)
106#define character(v) ((((zzhack *)(&(v))))->zz_character)
107#define address(v) ((((zzhack *)(&(v))))->zz_address)
108
109/*
110 * Escape command table definitions --
111 * lookup in this table is performed when ``escapec'' is recognized
112 * at the begining of a line (as defined by the eolmarks variable).
113*/
114
115typedef
116 struct {
117 char e_char; /* char to match on */
118 char e_flags; /* experimental, priviledged */
119 char *e_help; /* help string */
120 int (*e_func)(); /* command */
121 }
122 esctable_t;
123
124#define NORM 00 /* normal protection, execute anyone */
125#define EXP 01 /* experimental, mark it with a `*' on help */
126#define PRIV 02 /* priviledged, root execute only */
127
128extern int vflag; /* verbose during reading of .tiprc file */
129extern value_t vtable[]; /* variable table */
130
131#ifndef ACULOG
132#define logent(a, b, c, d)
133#define loginit()
134#endif
135
136/*
137 * Definition of indices into variable table so
138 * value(DEFINE) turns into a static address.
139 */
140
141#define BEAUTIFY 0
142#define BAUDRATE 1
143#define DIALTIMEOUT 2
144#define EOFREAD 3
145#define EOFWRITE 4
146#define EOL 5
147#define ESCAPE 6
148#define EXCEPTIONS 7
149#define FORCE 8
150#define FRAMESIZE 9
151#define HOST 10
152#if ACULOG
153#define LOCK 11
154#define LOG 12
155#define PHONES 13
156#define PROMPT 14
157#define RAISE 15
158#define RAISECHAR 16
159#define RECORD 17
160#define REMOTE 18
161#define SCRIPT 19
162#define TABEXPAND 20
163#define VERBOSE 21
164#define SHELL 22
165#define HOME 23
a2c6551c 166#define ECHOCHECK 24
11adac90
BJ
167#else
168#define PHONES 11
169#define PROMPT 12
170#define RAISE 13
171#define RAISECHAR 14
172#define RECORD 15
173#define REMOTE 16
174#define SCRIPT 17
175#define TABEXPAND 18
176#define VERBOSE 19
177#define SHELL 20
178#define HOME 21
a2c6551c 179#define ECHOCHECK 22
11adac90
BJ
180#endif
181
182#define NOVAL ((value_t *)NULL)
183#define NOACU ((acu_t *)NULL)
184#define NOSTR ((char *)NULL)
185#define NOFILE ((FILE *)NULL)
186#define NOPWD ((struct passwd *)0)
187
188struct sgttyb arg; /* current mode of local terminal */
189struct sgttyb defarg; /* initial mode of local terminal */
190struct tchars tchars; /* current state of terminal */
191struct tchars defchars; /* initial state of terminal */
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 */
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 */
236#endif
237
238extern char *ctrl();
239extern char *ctime();
240extern long time();
241extern struct passwd *getpwuid();
242extern char *getlogin();
243extern char *vinterp();
244extern char *getenv();
245extern char *rindex();
246extern char *index();
247extern char *malloc();
248extern char *connect();