|
|
1.1 root 1: /* tip.h 4.11 83/06/25 */
2:
3: /*
4: * tip - terminal interface program
5: */
6:
7: #include <sys/types.h>
8: #include <sys/file.h>
9:
10: #include <sgtty.h>
11: #include <signal.h>
12: #include <stdio.h>
13: #include <pwd.h>
14: #include <ctype.h>
15: #include <setjmp.h>
16: #include <errno.h>
17:
18: /*
19: * Remote host attributes
20: */
21: char *DV; /* UNIX device(s) to open */
22: char *EL; /* chars marking an EOL */
23: char *CM; /* initial connection message */
24: char *IE; /* EOT to expect on input */
25: char *OE; /* EOT to send to complete FT */
26: char *CU; /* call unit if making a phone call */
27: char *AT; /* acu type */
28: char *PN; /* phone number(s) */
29: char *DI; /* disconnect string */
30: char *PA; /* parity to be generated */
31:
32: char *PH; /* phone number file */
33: char *RM; /* remote file name */
34: char *HO; /* host name */
35:
36: int BR; /* line speed for conversation */
37: int FS; /* frame size for transfers */
38:
39: char DU; /* this host is dialed up */
40: char HW; /* this device is hardwired, see hunt.c */
41: char *ES; /* escape character */
42: char *EX; /* exceptions */
43: char *FO; /* force (literal next) char*/
44: char *RC; /* raise character */
45: char *RE; /* script record file */
46: char *PR; /* remote prompt */
47: int DL; /* line delay for file transfers to remote */
48: int CL; /* char delay for file transfers to remote */
49: int ET; /* echocheck timeout */
50: char HD; /* this host is half duplex - do local echo */
51:
52: /*
53: * String value table
54: */
55: typedef
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: */
89: typedef
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 */
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: */
106: typedef
107: union {
108: int zz_number;
109: short zz_boolean;
110: char zz_character;
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:
128: typedef
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:
141: extern int vflag; /* verbose during reading of .tiprc file */
142: extern 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
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
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:
194: struct sgttyb arg; /* current mode of local terminal */
195: struct sgttyb defarg; /* initial mode of local terminal */
196: struct tchars tchars; /* current state of terminal */
197: struct tchars defchars; /* initial state of terminal */
198: struct ltchars ltchars; /* current local characters of terminal */
199: struct ltchars deflchars; /* initial local characters of terminal */
200:
201: FILE *fscript; /* FILE for scripting */
202:
203: int fildes[2]; /* file transfer synchronization channel */
204: int repdes[2]; /* read process sychronization channel */
205: int FD; /* open file descriptor to remote host */
206: int AC; /* open file descriptor to dialer (v831 only) */
207: int vflag; /* print .tiprc initialization sequence */
208: int sfd; /* for ~< operation */
209: int pid; /* pid of tipout */
210: int stop; /* stop transfer session flag */
211: int quit; /* same; but on other end */
212: int intflag; /* recognized interrupt */
213: int stoprompt; /* for interrupting a prompt session */
214: int timedout; /* ~> transfer timedout */
215: int cumode; /* simulating the "cu" program */
216:
217: char fname[80]; /* file name buffer for ~< */
218: char copyname[80]; /* file name buffer for ~> */
219: char ccc; /* synchronization character */
220: char ch; /* for tipout */
221: char *uucplock; /* name of lock file for uucp's */
222:
223: int odisc; /* initial tty line discipline */
224: extern int disc; /* current tty discpline */
225:
226: extern char *ctrl();
227: extern char *ctime();
228: extern long time();
229: extern struct passwd *getpwuid();
230: extern char *getlogin();
231: extern char *vinterp();
232: extern char *getenv();
233: extern char *rindex();
234: extern char *index();
235: extern char *malloc();
236: extern char *connect();
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.