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>
62 * Remote host attributes
64 char *DV; /* UNIX device(s) to open */
65 char *EL; /* chars marking an EOL */
66 char *CM; /* initial connection message */
67 char *IE; /* EOT to expect on input */
68 char *OE; /* EOT to send to complete FT */
69 char *CU; /* call unit if making a phone call */
70 char *AT; /* acu type */
71 char *PN; /* phone number(s) */
72 char *DI; /* disconnect string */
73 char *PA; /* parity to be generated */
75 char *PH; /* phone number file */
76 char *RM; /* remote file name */
77 char *HO; /* host name */
79 long BR; /* line speed for conversation */
80 long FS; /* frame size for transfers */
82 short DU; /* this host is dialed up */
83 short HW; /* this device is hardwired, see hunt.c */
84 char *ES; /* escape character */
85 char *EX; /* exceptions */
86 char *FO; /* force (literal next) char*/
87 char *RC; /* raise character */
88 char *RE; /* script record file */
89 char *PR; /* remote prompt */
90 long DL; /* line delay for file transfers to remote */
91 long CL; /* char delay for file transfers to remote */
92 long ET; /* echocheck timeout */
93 long LD; /* line disc */
94 short HD; /* this host is half duplex - do local echo */
101 char *v_name; /* whose name is it */
102 char v_type; /* for interpreting set's */
103 char v_access; /* protection of touchy ones */
104 char *v_abrev; /* possible abbreviation */
105 char *v_value; /* casted to a union later */
109 #define STRING 01 /* string valued */
110 #define BOOL 02 /* true-false value */
111 #define NUMBER 04 /* numeric value */
112 #define CHAR 010 /* character value */
114 #define WRITE 01 /* write access to variable */
115 #define READ 02 /* read access */
117 #define CHANGED 01 /* low bit is used to show modification */
118 #define PUBLIC 1 /* public access rights */
119 #define PRIVATE 03 /* private to definer */
120 #define ROOT 05 /* root defined */
125 #define ENVIRON 020 /* initialize out of the environment */
126 #define IREMOTE 040 /* initialize out of remote structure */
127 #define INIT 0100 /* static data space used for initialization */
131 * Definition of ACU line description
136 int (*acu_dialer)(char *, char *);
137 void (*acu_disconnect)(void);
138 void (*acu_abort)(void);
142 #define equal(a, b) (strcmp(a,b)==0)/* A nice function to string compare */
145 * variable manipulation stuff --
146 * if we defined the value entry in value_t, then we couldn't
147 * initialize it in vars.c, so we cast it as needed to keep lint
151 #define value(v) vtable[v].v_value
152 #define lvalue(v) (long)vtable[v].v_value
154 #define number(v) ((long)(v))
155 #define boolean(v) ((short)(long)(v))
156 #define character(v) ((char)(long)(v))
157 #define address(v) ((long *)(v))
159 #define setnumber(v,n) do { (v) = (char *)(long)(n); } while (0)
160 #define setboolean(v,n) do { (v) = (char *)(long)(n); } while (0)
161 #define setcharacter(v,n) do { (v) = (char *)(long)(n); } while (0)
162 #define setaddress(v,n) do { (v) = (char *)(n); } while (0)
165 * Escape command table definitions --
166 * lookup in this table is performed when ``escapec'' is recognized
167 * at the beginning of a line (as defined by the eolmarks variable).
172 char e_char; /* char to match on */
173 char e_flags; /* experimental, privileged */
174 char *e_help; /* help string */
175 void (*e_func)(int); /* command */
179 #define NORM 00 /* normal protection, execute anyone */
180 #define EXP 01 /* experimental, mark it with a `*' on help */
181 #define PRIV 02 /* privileged, root execute only */
183 extern int vflag; /* verbose during reading of .tiprc file */
184 extern int noesc; /* no escape `~' char */
185 extern value_t vtable[]; /* variable table */
188 #define logent(a, b, c, d)
193 * Definition of indices into variable table so
194 * value(DEFINE) turns into a static address.
199 #define DIALTIMEOUT 2
221 #define DISCONNECT 24
227 #define HALFDUPLEX 30
230 #define HARDWAREFLOW 33
234 #define NOVAL ((value_t *)NULL)
235 #define NOACU ((acu_t *)NULL)
236 #define NOSTR ((char *)NULL)
237 #define NOFILE ((FILE *)NULL)
238 #define NOPWD ((struct passwd *)0)
240 struct termios term; /* current mode of terminal */
241 struct termios defterm; /* initial mode of terminal */
242 struct termios defchars; /* current mode with initial chars */
245 FILE *fscript; /* FILE for scripting */
247 int fildes[2]; /* file transfer synchronization channel */
248 int repdes[2]; /* read process sychronization channel */
249 int FD; /* open file descriptor to remote host */
250 int AC; /* open file descriptor to dialer (v831 only) */
251 int vflag; /* print .tiprc initialization sequence */
252 int noesc; /* no `~' escape char */
253 int sfd; /* for ~< operation */
254 pid_t tipin_pid; /* pid of tipin */
255 pid_t tipout_pid; /* pid of tipout */
256 uid_t uid, euid; /* real and effective user id's */
257 gid_t gid, egid; /* real and effective group id's */
258 int stop; /* stop transfer session flag */
259 int quit; /* same; but on other end */
260 int intflag; /* recognized interrupt */
261 int stoprompt; /* for interrupting a prompt session */
262 int timedout; /* ~> transfer timedout */
263 int cumode; /* simulating the "cu" program */
264 int bits8; /* terminal is 8-bit mode */
265 #define STRIP_PAR (bits8 ? 0377 : 0177)
267 char fname[PATH_MAX]; /* file name buffer for ~< */
268 char copyname[PATH_MAX]; /* file name buffer for ~> */
269 char ccc; /* synchronization character */
270 char *uucplock; /* name of lock file for uucp's */
272 int odisc; /* initial tty line discipline */
273 extern int disc; /* current tty discpline */
275 extern char *__progname; /* program name */
279 char *expand(char *);
280 char *getremote(char *);
281 char *interp(char *);
282 int any(int, char *);
283 int biz22w_dialer(char *, char *);
284 int biz22f_dialer(char *, char *);
285 int biz31w_dialer(char *, char *);
286 int biz31f_dialer(char *, char *);
287 int cour_dialer(char *, char *);
288 int df02_dialer(char *, char *);
289 int df03_dialer(char *, char *);
290 int dn_dialer(char *, char *);
291 int hay_dialer(char *, char *);
292 int prompt(char *, char *, size_t);
294 int t3000_dialer(char *, char *);
297 int uu_unlock(char *);
298 int v3451_dialer(char *, char *);
299 int v831_dialer(char *, char *);
300 int ven_dialer(char *, char *);
301 int vstring(char *, char *);
303 void biz22_disconnect(void);
304 void biz22_abort(void);
305 void biz31_disconnect(void);
306 void biz31_abort(void);
307 void chdirectory(int);
310 void cour_abort(void);
311 void cour_disconnect(void);
314 void cumain(int, char **);
315 void daemon_uid(void);
317 void df_disconnect(void);
318 void disconnect(char *);
320 void dn_disconnect(void);
324 void hay_abort(void);
325 void hay_disconnect(void);
327 void listvariables(int);
328 void logent(char *, char *, char *, char *);
330 void parwrite(int, char *, size_t);
335 void setparity(char *);
336 void setscript(void);
338 void shell_uid(void);
340 void t3000_disconnect(void);
341 void t3000_abort(void);
343 void tipabort(char *);
348 void v3451_abort(void);
349 void v3451_disconnect(void);
350 void v831_disconnect(void);
351 void v831_abort(void);
353 void ven_disconnect(void);
354 void ven_abort(void);