|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1983 Regents of the University of California. ! 3: * All rights reserved. The Berkeley software License Agreement ! 4: * specifies the terms and conditions for redistribution. ! 5: * ! 6: * @(#)tip.h 5.3 (Berkeley) 10/19/86 ! 7: */ ! 8: ! 9: /* ! 10: * tip - terminal interface program ! 11: */ ! 12: ! 13: #include <sys/types.h> ! 14: #include <sys/file.h> ! 15: ! 16: #include <sgtty.h> ! 17: #include <signal.h> ! 18: #include <stdio.h> ! 19: #include <pwd.h> ! 20: #include <ctype.h> ! 21: #include <setjmp.h> ! 22: #include <errno.h> ! 23: ! 24: /* ! 25: * Remote host attributes ! 26: */ ! 27: char *DV; /* UNIX device(s) to open */ ! 28: char *EL; /* chars marking an EOL */ ! 29: char *CM; /* initial connection message */ ! 30: char *IE; /* EOT to expect on input */ ! 31: char *OE; /* EOT to send to complete FT */ ! 32: char *CU; /* call unit if making a phone call */ ! 33: char *AT; /* acu type */ ! 34: char *PN; /* phone number(s) */ ! 35: char *DI; /* disconnect string */ ! 36: char *PA; /* parity to be generated */ ! 37: ! 38: char *PH; /* phone number file */ ! 39: char *RM; /* remote file name */ ! 40: char *HO; /* host name */ ! 41: ! 42: int BR; /* line speed for conversation */ ! 43: int FS; /* frame size for transfers */ ! 44: ! 45: char DU; /* this host is dialed up */ ! 46: char HW; /* this device is hardwired, see hunt.c */ ! 47: char *ES; /* escape character */ ! 48: char *EX; /* exceptions */ ! 49: char *FO; /* force (literal next) char*/ ! 50: char *RC; /* raise character */ ! 51: char *RE; /* script record file */ ! 52: char *PR; /* remote prompt */ ! 53: int DL; /* line delay for file transfers to remote */ ! 54: int CL; /* char delay for file transfers to remote */ ! 55: int ET; /* echocheck timeout */ ! 56: char HD; /* this host is half duplex - do local echo */ ! 57: ! 58: /* ! 59: * String value table ! 60: */ ! 61: typedef ! 62: struct { ! 63: char *v_name; /* whose name is it */ ! 64: char v_type; /* for interpreting set's */ ! 65: char v_access; /* protection of touchy ones */ ! 66: char *v_abrev; /* possible abreviation */ ! 67: char *v_value; /* casted to a union later */ ! 68: } ! 69: value_t; ! 70: ! 71: #define STRING 01 /* string valued */ ! 72: #define BOOL 02 /* true-false value */ ! 73: #define NUMBER 04 /* numeric value */ ! 74: #define CHAR 010 /* character value */ ! 75: ! 76: #define WRITE 01 /* write access to variable */ ! 77: #define READ 02 /* read access */ ! 78: ! 79: #define CHANGED 01 /* low bit is used to show modification */ ! 80: #define PUBLIC 1 /* public access rights */ ! 81: #define PRIVATE 03 /* private to definer */ ! 82: #define ROOT 05 /* root defined */ ! 83: ! 84: #define TRUE 1 ! 85: #define FALSE 0 ! 86: ! 87: #define ENVIRON 020 /* initialize out of the environment */ ! 88: #define IREMOTE 040 /* initialize out of remote structure */ ! 89: #define INIT 0100 /* static data space used for initialization */ ! 90: #define TMASK 017 ! 91: ! 92: /* ! 93: * Definition of ACU line description ! 94: */ ! 95: typedef ! 96: struct { ! 97: char *acu_name; ! 98: int (*acu_dialer)(); ! 99: int (*acu_disconnect)(); ! 100: int (*acu_abort)(); ! 101: } ! 102: acu_t; ! 103: ! 104: #define equal(a, b) (strcmp(a,b)==0)/* A nice function to string compare */ ! 105: ! 106: /* ! 107: * variable manipulation stuff -- ! 108: * if we defined the value entry in value_t, then we couldn't ! 109: * initialize it in vars.c, so we cast it as needed to keep lint ! 110: * happy. ! 111: */ ! 112: typedef ! 113: union { ! 114: int zz_number; ! 115: short zz_boolean[2]; ! 116: char zz_character[4]; ! 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 vax ! 125: #define boolean(v) ((((zzhack *)(&(v))))->zz_boolean[0]) ! 126: #define character(v) ((((zzhack *)(&(v))))->zz_character[0]) ! 127: #else ! 128: #define boolean(v) ((((zzhack *)(&(v))))->zz_boolean[1]) ! 129: #define character(v) ((((zzhack *)(&(v))))->zz_character[3]) ! 130: #endif ! 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 ! 198: ! 199: #define NOVAL ((value_t *)NULL) ! 200: #define NOACU ((acu_t *)NULL) ! 201: #define NOSTR ((char *)NULL) ! 202: #define NOFILE ((FILE *)NULL) ! 203: #define NOPWD ((struct passwd *)0) ! 204: ! 205: struct sgttyb arg; /* current mode of local terminal */ ! 206: struct sgttyb defarg; /* initial mode of local terminal */ ! 207: struct tchars tchars; /* current state of terminal */ ! 208: struct tchars defchars; /* initial state of terminal */ ! 209: struct ltchars ltchars; /* current local characters of terminal */ ! 210: struct ltchars deflchars; /* initial local characters of terminal */ ! 211: ! 212: FILE *fscript; /* FILE for scripting */ ! 213: ! 214: int fildes[2]; /* file transfer synchronization channel */ ! 215: int repdes[2]; /* read process sychronization channel */ ! 216: int FD; /* open file descriptor to remote host */ ! 217: int AC; /* open file descriptor to dialer (v831 only) */ ! 218: int vflag; /* print .tiprc initialization sequence */ ! 219: int sfd; /* for ~< operation */ ! 220: int pid; /* pid of tipout */ ! 221: uid_t uid, euid; /* real and effective user id's */ ! 222: gid_t gid, egid; /* real and effective group id's */ ! 223: int stop; /* stop transfer session flag */ ! 224: int quit; /* same; but on other end */ ! 225: int intflag; /* recognized interrupt */ ! 226: int stoprompt; /* for interrupting a prompt session */ ! 227: int timedout; /* ~> transfer timedout */ ! 228: int cumode; /* simulating the "cu" program */ ! 229: ! 230: char fname[80]; /* file name buffer for ~< */ ! 231: char copyname[80]; /* file name buffer for ~> */ ! 232: char ccc; /* synchronization character */ ! 233: char ch; /* for tipout */ ! 234: char *uucplock; /* name of lock file for uucp's */ ! 235: ! 236: int odisc; /* initial tty line discipline */ ! 237: extern int disc; /* current tty discpline */ ! 238: ! 239: extern char *ctrl(); ! 240: extern char *ctime(); ! 241: extern long time(); ! 242: extern struct passwd *getpwuid(); ! 243: extern char *getlogin(); ! 244: extern char *vinterp(); ! 245: extern char *getenv(); ! 246: extern char *rindex(); ! 247: extern char *index(); ! 248: extern char *malloc(); ! 249: extern char *connect();
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.