|
|
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 */
1.1.1.2 ! root 51: int TO; /* tip timeout value (forces logout) */
1.1 root 52:
53: /*
54: * String value table
55: */
56: typedef
57: struct {
58: char *v_name; /* whose name is it */
59: char v_type; /* for interpreting set's */
60: char v_access; /* protection of touchy ones */
61: char *v_abrev; /* possible abreviation */
62: char *v_value; /* casted to a union later */
63: }
64: value_t;
65:
66: #define STRING 01 /* string valued */
67: #define BOOL 02 /* true-false value */
68: #define NUMBER 04 /* numeric value */
69: #define CHAR 010 /* character value */
70:
71: #define WRITE 01 /* write access to variable */
72: #define READ 02 /* read access */
73:
74: #define CHANGED 01 /* low bit is used to show modification */
75: #define PUBLIC 1 /* public access rights */
76: #define PRIVATE 03 /* private to definer */
77: #define ROOT 05 /* root defined */
78:
79: #define TRUE 1
80: #define FALSE 0
81:
82: #define ENVIRON 020 /* initialize out of the environment */
83: #define IREMOTE 040 /* initialize out of remote structure */
84: #define INIT 0100 /* static data space used for initialization */
85: #define TMASK 017
86:
87: /*
88: * Definition of ACU line description
89: */
90: typedef
91: struct {
92: char *acu_name;
93: int (*acu_dialer)();
94: int (*acu_disconnect)();
95: int (*acu_abort)();
96: }
97: acu_t;
98:
99: #define equal(a, b) (strcmp(a,b)==0)/* A nice function to string compare */
100:
101: /*
102: * variable manipulation stuff --
103: * if we defined the value entry in value_t, then we couldn't
104: * initialize it in vars.c, so we cast it as needed to keep lint
105: * happy.
106: */
107: typedef
108: union {
109: int zz_number;
110: #ifdef tahoe
111: short zz_boolean[2];
112: char zz_character[4];
113: #else tahoe
114: short zz_boolean;
115: char zz_character;
116: #endif tahoe
117: int *zz_address;
118: }
119: zzhack;
120:
121: #define value(v) vtable[v].v_value
122:
123: #define number(v) ((((zzhack *)(&(v))))->zz_number)
124: #ifdef tahoe
125: #define boolean(v) ((((zzhack *)(&(v))))->zz_boolean[1])
126: #define character(v) ((((zzhack *)(&(v))))->zz_character[3])
127: #else tahoe
128: #define boolean(v) ((((zzhack *)(&(v))))->zz_boolean)
129: #define character(v) ((((zzhack *)(&(v))))->zz_character)
130: #endif tahoe
131: #define address(v) ((((zzhack *)(&(v))))->zz_address)
132:
133: /*
134: * Escape command table definitions --
135: * lookup in this table is performed when ``escapec'' is recognized
136: * at the begining of a line (as defined by the eolmarks variable).
137: */
138:
139: typedef
140: struct {
141: char e_char; /* char to match on */
142: char e_flags; /* experimental, priviledged */
143: char *e_help; /* help string */
144: int (*e_func)(); /* command */
145: }
146: esctable_t;
147:
148: #define NORM 00 /* normal protection, execute anyone */
149: #define EXP 01 /* experimental, mark it with a `*' on help */
150: #define PRIV 02 /* priviledged, root execute only */
151:
152: extern int vflag; /* verbose during reading of .tiprc file */
153: extern value_t vtable[]; /* variable table */
154:
155: #ifndef ACULOG
156: #define logent(a, b, c, d)
157: #define loginit()
158: #endif
159:
160: /*
161: * Definition of indices into variable table so
162: * value(DEFINE) turns into a static address.
163: */
164:
165: #define BEAUTIFY 0
166: #define BAUDRATE 1
167: #define DIALTIMEOUT 2
168: #define EOFREAD 3
169: #define EOFWRITE 4
170: #define EOL 5
171: #define ESCAPE 6
172: #define EXCEPTIONS 7
173: #define FORCE 8
174: #define FRAMESIZE 9
175: #define HOST 10
176: #define LOG 11
177: #define PHONES 12
178: #define PROMPT 13
179: #define RAISE 14
180: #define RAISECHAR 15
181: #define RECORD 16
182: #define REMOTE 17
183: #define SCRIPT 18
184: #define TABEXPAND 19
185: #define VERBOSE 20
186: #define SHELL 21
187: #define HOME 22
188: #define ECHOCHECK 23
189: #define DISCONNECT 24
190: #define TAND 25
191: #define LDELAY 26
192: #define CDELAY 27
193: #define ETIMEOUT 28
194: #define RAWFTP 29
195: #define HALFDUPLEX 30
196: #define LECHO 31
197: #define PARITY 32
1.1.1.2 ! root 198: #define TIMEOUT 33
1.1 root 199:
200: #define NOVAL ((value_t *)NULL)
201: #define NOACU ((acu_t *)NULL)
202: #define NOSTR ((char *)NULL)
203: #define NOFILE ((FILE *)NULL)
204: #define NOPWD ((struct passwd *)0)
205:
206: struct sgttyb arg; /* current mode of local terminal */
207: struct sgttyb defarg; /* initial mode of local terminal */
208: struct tchars tchars; /* current state of terminal */
209: struct tchars defchars; /* initial state of terminal */
210: struct ltchars ltchars; /* current local characters of terminal */
211: struct ltchars deflchars; /* initial local characters of terminal */
212:
213: FILE *fscript; /* FILE for scripting */
214:
215: int fildes[2]; /* file transfer synchronization channel */
216: int repdes[2]; /* read process sychronization channel */
217: int FD; /* open file descriptor to remote host */
218: int AC; /* open file descriptor to dialer (v831 only) */
219: int vflag; /* print .tiprc initialization sequence */
220: int sfd; /* for ~< operation */
221: int pid; /* pid of tipout */
222: int stop; /* stop transfer session flag */
223: int quit; /* same; but on other end */
224: int intflag; /* recognized interrupt */
225: int stoprompt; /* for interrupting a prompt session */
226: int timedout; /* ~> transfer timedout */
1.1.1.2 ! root 227: int timer_expired; /* logout timer flag */
1.1 root 228: int cumode; /* simulating the "cu" program */
229:
230: char fname[80]; /* file name buffer for ~< */
231: char copyname[80]; /* file name buffer for ~> */
1.1.1.2 ! root 232: char minutes[80]; /* file name buffer for ~m */
1.1 root 233: char ccc; /* synchronization character */
234: char ch; /* for tipout */
235: char *uucplock; /* name of lock file for uucp's */
236:
237: int odisc; /* initial tty line discipline */
238: extern int disc; /* current tty discpline */
239:
240: extern char *ctrl();
241: extern char *ctime();
242: extern long time();
243: extern struct passwd *getpwuid();
244: extern char *getlogin();
245: extern char *vinterp();
246: extern char *getenv();
247: extern char *rindex();
248: extern char *index();
249: extern char *malloc();
250: extern char *connect();
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.