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