Annotation of cci/usr/src/usr.bin/tip/tip.h, revision 1.1.1.1

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: #ifdef tahoe
                    110:                short   zz_boolean[2];
                    111:                char    zz_character[4];
                    112: #else tahoe
                    113:                short   zz_boolean;
                    114:                char    zz_character;
                    115: #endif tahoe
                    116:                int     *zz_address;
                    117:        }
                    118:        zzhack;
                    119: 
                    120: #define value(v)       vtable[v].v_value
                    121: 
                    122: #define number(v)      ((((zzhack *)(&(v))))->zz_number)
                    123: #ifdef tahoe
                    124: #define boolean(v)     ((((zzhack *)(&(v))))->zz_boolean[1])
                    125: #define character(v)   ((((zzhack *)(&(v))))->zz_character[3])
                    126: #else tahoe
                    127: #define boolean(v)     ((((zzhack *)(&(v))))->zz_boolean)
                    128: #define character(v)   ((((zzhack *)(&(v))))->zz_character)
                    129: #endif tahoe
                    130: #define address(v)     ((((zzhack *)(&(v))))->zz_address)
                    131: 
                    132: /*
                    133:  * Escape command table definitions --
                    134:  *   lookup in this table is performed when ``escapec'' is recognized
                    135:  *   at the begining of a line (as defined by the eolmarks variable).
                    136: */
                    137: 
                    138: typedef
                    139:        struct {
                    140:                char    e_char;         /* char to match on */
                    141:                char    e_flags;        /* experimental, priviledged */
                    142:                char    *e_help;        /* help string */
                    143:                int     (*e_func)();    /* command */
                    144:        }
                    145:        esctable_t;
                    146: 
                    147: #define NORM   00              /* normal protection, execute anyone */
                    148: #define EXP    01              /* experimental, mark it with a `*' on help */
                    149: #define PRIV   02              /* priviledged, root execute only */
                    150: 
                    151: extern int     vflag;          /* verbose during reading of .tiprc file */
                    152: extern value_t vtable[];       /* variable table */
                    153: 
                    154: #ifndef ACULOG
                    155: #define logent(a, b, c, d)
                    156: #define loginit()
                    157: #endif
                    158: 
                    159: /*
                    160:  * Definition of indices into variable table so
                    161:  *  value(DEFINE) turns into a static address.
                    162:  */
                    163: 
                    164: #define BEAUTIFY       0
                    165: #define BAUDRATE       1
                    166: #define DIALTIMEOUT    2
                    167: #define EOFREAD                3
                    168: #define EOFWRITE       4
                    169: #define EOL            5
                    170: #define ESCAPE         6
                    171: #define EXCEPTIONS     7
                    172: #define FORCE          8
                    173: #define FRAMESIZE      9
                    174: #define HOST           10
                    175: #define LOG            11
                    176: #define PHONES         12
                    177: #define PROMPT         13
                    178: #define RAISE          14
                    179: #define RAISECHAR      15
                    180: #define RECORD         16
                    181: #define REMOTE         17
                    182: #define SCRIPT         18
                    183: #define TABEXPAND      19
                    184: #define VERBOSE                20
                    185: #define SHELL          21
                    186: #define HOME           22
                    187: #define ECHOCHECK      23
                    188: #define DISCONNECT     24
                    189: #define TAND           25
                    190: #define LDELAY         26
                    191: #define CDELAY         27
                    192: #define ETIMEOUT       28
                    193: #define RAWFTP         29
                    194: #define HALFDUPLEX     30
                    195: #define        LECHO           31
                    196: #define        PARITY          32
                    197: 
                    198: #define NOVAL  ((value_t *)NULL)
                    199: #define NOACU  ((acu_t *)NULL)
                    200: #define NOSTR  ((char *)NULL)
                    201: #define NOFILE ((FILE *)NULL)
                    202: #define NOPWD  ((struct passwd *)0)
                    203: 
                    204: struct sgttyb  arg;            /* current mode of local terminal */
                    205: struct sgttyb  defarg;         /* initial mode of local terminal */
                    206: struct tchars  tchars;         /* current state of terminal */
                    207: struct tchars  defchars;       /* initial state of terminal */
                    208: struct ltchars ltchars;        /* current local characters of terminal */
                    209: struct ltchars deflchars;      /* initial local characters of terminal */
                    210: 
                    211: FILE   *fscript;               /* FILE for scripting */
                    212: 
                    213: int    fildes[2];              /* file transfer synchronization channel */
                    214: int    repdes[2];              /* read process sychronization channel */
                    215: int    FD;                     /* open file descriptor to remote host */
                    216: int    AC;                     /* open file descriptor to dialer (v831 only) */
                    217: int    vflag;                  /* print .tiprc initialization sequence */
                    218: int    sfd;                    /* for ~< operation */
                    219: int    pid;                    /* pid of tipout */
                    220: int    stop;                   /* stop transfer session flag */
                    221: int    quit;                   /* same; but on other end */
                    222: int    intflag;                /* recognized interrupt */
                    223: int    stoprompt;              /* for interrupting a prompt session */
                    224: int    timedout;               /* ~> transfer timedout */
                    225: int    cumode;                 /* simulating the "cu" program */
                    226: 
                    227: char   fname[80];              /* file name buffer for ~< */
                    228: char   copyname[80];           /* file name buffer for ~> */
                    229: char   ccc;                    /* synchronization character */
                    230: char   ch;                     /* for tipout */
                    231: char   *uucplock;              /* name of lock file for uucp's */
                    232: 
                    233: int    odisc;                          /* initial tty line discipline */
                    234: extern int disc;                       /* current tty discpline */
                    235: 
                    236: extern char *ctrl();
                    237: extern char *ctime();
                    238: extern long time();
                    239: extern struct passwd *getpwuid();
                    240: extern char *getlogin();
                    241: extern char *vinterp();
                    242: extern char *getenv();
                    243: extern char *rindex();
                    244: extern char *index();
                    245: extern char *malloc();
                    246: extern char *connect();

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.