1 /* $OpenBSD: tip.h,v 1.27 2006/08/18 03:06:18 jason Exp $ */
2 /* $NetBSD: tip.h,v 1.7 1997/04/20 00:02:46 mellon Exp $ */
6 * SPDX-License-Identifier: BSD-3-Clause
8 * Copyright (c) 1989, 1993
9 * The Regents of the University of California. All rights reserved.
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 * 3. Neither the name of the University nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * @(#)tip.h 8.1 (Berkeley) 6/6/93
40 * tip - terminal interface program
43 #include <sys/types.h>
47 #include <sys/ioctl.h>
66 * Remote host attributes
68 EXTERN char *DV; /* UNIX device(s) to open */
69 EXTERN char *EL; /* chars marking an EOL */
70 EXTERN char *CM; /* initial connection message */
71 EXTERN char *IE; /* EOT to expect on input */
72 EXTERN char *OE; /* EOT to send to complete FT */
73 EXTERN char *CU; /* call unit if making a phone call */
74 EXTERN char *AT; /* acu type */
75 EXTERN char *PN; /* phone number(s) */
76 EXTERN char *DI; /* disconnect string */
77 EXTERN char *PA; /* parity to be generated */
79 EXTERN char *PH; /* phone number file */
80 EXTERN char *RM; /* remote file name */
81 EXTERN char *HO; /* host name */
83 EXTERN long BR; /* line speed for conversation */
84 EXTERN long FS; /* frame size for transfers */
86 EXTERN short DU; /* this host is dialed up */
87 EXTERN short HW; /* this device is hardwired, see hunt.c */
88 EXTERN char *ES; /* escape character */
89 EXTERN char *EX; /* exceptions */
90 EXTERN char *FO; /* force (literal next) char*/
91 EXTERN char *RC; /* raise character */
92 EXTERN char *RE; /* script record file */
93 EXTERN char *PR; /* remote prompt */
94 EXTERN long DL; /* line delay for file transfers to remote */
95 EXTERN long CL; /* char delay for file transfers to remote */
96 EXTERN long ET; /* echocheck timeout */
97 EXTERN long LD; /* line disc */
98 EXTERN short HD; /* this host is half duplex - do local echo */
105 char *v_name; /* whose name is it */
106 char v_type; /* for interpreting set's */
107 char v_access; /* protection of touchy ones */
108 char *v_abrev; /* possible abbreviation */
109 char *v_value; /* casted to a union later */
113 #define STRING 01 /* string valued */
114 #define BOOL 02 /* true-false value */
115 #define NUMBER 04 /* numeric value */
116 #define CHAR 010 /* character value */
118 #define WRITE 01 /* write access to variable */
119 #define READ 02 /* read access */
121 #define CHANGED 01 /* low bit is used to show modification */
122 #define PUBLIC 1 /* public access rights */
123 #define PRIVATE 03 /* private to definer */
124 #define ROOT 05 /* root defined */
129 #define ENVIRON 020 /* initialize out of the environment */
130 #define IREMOTE 040 /* initialize out of remote structure */
131 #define INIT 0100 /* static data space used for initialization */
135 * Definition of ACU line description
140 int (*acu_dialer)(char *, char *);
141 void (*acu_disconnect)(void);
142 void (*acu_abort)(void);
146 #define equal(a, b) (strcmp(a,b)==0)/* A nice function to string compare */
149 * variable manipulation stuff --
150 * if we defined the value entry in value_t, then we couldn't
151 * initialize it in vars.c, so we cast it as needed to keep lint
155 #define value(v) vtable[v].v_value
156 #define lvalue(v) (long)vtable[v].v_value
158 #define number(v) ((long)(v))
159 #define boolean(v) ((short)(long)(v))
160 #define character(v) ((char)(long)(v))
161 #define address(v) ((long *)(v))
163 #define setnumber(v,n) do { (v) = (char *)(long)(n); } while (0)
164 #define setboolean(v,n) do { (v) = (char *)(long)(n); } while (0)
165 #define setcharacter(v,n) do { (v) = (char *)(long)(n); } while (0)
166 #define setaddress(v,n) do { (v) = (char *)(n); } while (0)
169 * Escape command table definitions --
170 * lookup in this table is performed when ``escapec'' is recognized
171 * at the beginning of a line (as defined by the eolmarks variable).
176 char e_char; /* char to match on */
177 char e_flags; /* experimental, privileged */
178 char *e_help; /* help string */
179 void (*e_func)(int); /* command */
183 #define NORM 00 /* normal protection, execute anyone */
184 #define EXP 01 /* experimental, mark it with a `*' on help */
185 #define PRIV 02 /* privileged, root execute only */
187 extern int vflag; /* verbose during reading of .tiprc file */
188 extern int noesc; /* no escape `~' char */
189 extern value_t vtable[]; /* variable table */
192 #define logent(a, b, c, d)
197 * Definition of indices into variable table so
198 * value(DEFINE) turns into a static address.
203 #define DIALTIMEOUT 2
225 #define DISCONNECT 24
231 #define HALFDUPLEX 30
234 #define HARDWAREFLOW 33
238 #define NOVAL ((value_t *)NULL)
239 #define NOACU ((acu_t *)NULL)
240 #define NOSTR ((char *)NULL)
241 #define NOFILE ((FILE *)NULL)
242 #define NOPWD ((struct passwd *)0)
244 EXTERN struct termios term; /* current mode of terminal */
245 EXTERN struct termios defterm; /* initial mode of terminal */
246 EXTERN struct termios defchars; /* current mode with initial chars */
247 EXTERN int gotdefterm;
249 EXTERN FILE *fscript; /* FILE for scripting */
251 EXTERN int fildes[2]; /* file transfer synchronization channel */
252 EXTERN int repdes[2]; /* read process sychronization channel */
253 EXTERN int FD; /* open file descriptor to remote host */
254 EXTERN int AC; /* open file descriptor to dialer (v831 only) */
255 EXTERN int vflag; /* print .tiprc initialization sequence */
256 EXTERN int noesc; /* no `~' escape char */
257 EXTERN int sfd; /* for ~< operation */
258 EXTERN pid_t tipin_pid; /* pid of tipin */
259 EXTERN pid_t tipout_pid; /* pid of tipout */
260 EXTERN uid_t uid, euid; /* real and effective user id's */
261 EXTERN gid_t gid, egid; /* real and effective group id's */
262 EXTERN int stop; /* stop transfer session flag */
263 EXTERN int quit; /* same; but on other end */
264 EXTERN int intflag; /* recognized interrupt */
265 EXTERN int stoprompt; /* for interrupting a prompt session */
266 EXTERN int timedout; /* ~> transfer timedout */
267 EXTERN int cumode; /* simulating the "cu" program */
268 EXTERN int bits8; /* terminal is 8-bit mode */
269 #define STRIP_PAR (bits8 ? 0377 : 0177)
271 EXTERN char fname[PATH_MAX]; /* file name buffer for ~< */
272 EXTERN char copyname[PATH_MAX]; /* file name buffer for ~> */
273 EXTERN char ccc; /* synchronization character */
274 EXTERN char *uucplock; /* name of lock file for uucp's */
276 EXTERN int odisc; /* initial tty line discipline */
277 extern int disc; /* current tty discpline */
279 extern char *__progname; /* program name */
283 char *expand(char *);
284 char *getremote(char *);
285 char *interp(char *);
286 int any(int, char *);
287 int biz22w_dialer(char *, char *);
288 int biz22f_dialer(char *, char *);
289 int biz31w_dialer(char *, char *);
290 int biz31f_dialer(char *, char *);
291 int cour_dialer(char *, char *);
292 int df02_dialer(char *, char *);
293 int df03_dialer(char *, char *);
294 int dn_dialer(char *, char *);
295 int hay_dialer(char *, char *);
296 int prompt(char *, char *, size_t);
298 int t3000_dialer(char *, char *);
301 int uu_unlock(char *);
302 int v3451_dialer(char *, char *);
303 int v831_dialer(char *, char *);
304 int ven_dialer(char *, char *);
305 int vstring(char *, char *);
307 void biz22_disconnect(void);
308 void biz22_abort(void);
309 void biz31_disconnect(void);
310 void biz31_abort(void);
311 void chdirectory(int);
314 void cour_abort(void);
315 void cour_disconnect(void);
318 void cumain(int, char **);
319 void daemon_uid(void);
321 void df_disconnect(void);
322 void disconnect(char *);
324 void dn_disconnect(void);
328 void hay_abort(void);
329 void hay_disconnect(void);
331 void listvariables(int);
332 void logent(char *, char *, char *, char *);
334 void parwrite(int, char *, size_t);
339 void setparity(char *);
340 void setscript(void);
342 void shell_uid(void);
344 void t3000_disconnect(void);
345 void t3000_abort(void);
347 void tipabort(char *);
352 void v3451_abort(void);
353 void v3451_disconnect(void);
354 void v831_disconnect(void);
355 void v831_abort(void);
357 void ven_disconnect(void);
358 void ven_abort(void);