386BSD 0.1 development
[unix-history] / usr / src / usr.bin / tip / tip.h
index 22c1feb..e0614eb 100644 (file)
@@ -1,16 +1,57 @@
-/*     tip.h   4.10    83/06/15        */
 /*
 /*
- * tip - terminal interface program
+ * Copyright (c) 1983 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
  *
  *
- * Samuel J. Leffler
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     @(#)tip.h       5.7 (Berkeley) 3/27/91
+ */
+
+/*
+ * tip - terminal interface program
  */
 
  */
 
+#include <sys/types.h>
+#include <machine/endian.h>
+#include <sys/file.h>
+#include <sys/time.h>
+
 #include <sgtty.h>
 #include <signal.h>
 #include <stdio.h>
 #include <sgtty.h>
 #include <signal.h>
 #include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 #include <pwd.h>
 #include <pwd.h>
-#include <sys/types.h>
 #include <ctype.h>
 #include <ctype.h>
+#include <setjmp.h>
+#include <unistd.h>
+#include <errno.h>
 
 /*
  * Remote host attributes
 
 /*
  * Remote host attributes
@@ -103,17 +144,26 @@ typedef
 typedef
        union {
                int     zz_number;
 typedef
        union {
                int     zz_number;
-               short   zz_boolean;
-               char    zz_character;
+               short   zz_boolean[2];
+               char    zz_character[4];
                int     *zz_address;
        }
        zzhack;
 
 #define value(v)       vtable[v].v_value
 
                int     *zz_address;
        }
        zzhack;
 
 #define value(v)       vtable[v].v_value
 
-#define boolean(v)     ((((zzhack *)(&(v))))->zz_boolean)
 #define number(v)      ((((zzhack *)(&(v))))->zz_number)
 #define number(v)      ((((zzhack *)(&(v))))->zz_number)
-#define character(v)   ((((zzhack *)(&(v))))->zz_character)
+
+#if BYTE_ORDER == LITTLE_ENDIAN
+#define boolean(v)     ((((zzhack *)(&(v))))->zz_boolean[0])
+#define character(v)   ((((zzhack *)(&(v))))->zz_character[0])
+#endif
+
+#if BYTE_ORDER == BIG_ENDIAN
+#define boolean(v)     ((((zzhack *)(&(v))))->zz_boolean[1])
+#define character(v)   ((((zzhack *)(&(v))))->zz_character[3])
+#endif
+
 #define address(v)     ((((zzhack *)(&(v))))->zz_address)
 
 /*
 #define address(v)     ((((zzhack *)(&(v))))->zz_address)
 
 /*
@@ -159,53 +209,28 @@ extern value_t    vtable[];       /* variable table */
 #define FORCE          8
 #define FRAMESIZE      9
 #define HOST           10
 #define FORCE          8
 #define FRAMESIZE      9
 #define HOST           10
-#if ACULOG
-#define LOCK           11
-#define LOG            12
-#define PHONES         13
-#define PROMPT         14
-#define RAISE          15
-#define RAISECHAR      16
-#define RECORD         17
-#define REMOTE         18
-#define SCRIPT         19
-#define TABEXPAND      20
-#define VERBOSE                21
-#define SHELL          22
-#define HOME           23
-#define ECHOCHECK      24
-#define DISCONNECT     25
-#define TAND           26
-#define LDELAY         27
-#define CDELAY         28
-#define ETIMEOUT       29
-#define RAWFTP         30
-#define HALFDUPLEX     31
-#define        LECHO           32
-#define        PARITY          33
-#else
-#define PHONES         11
-#define PROMPT         12
-#define RAISE          13
-#define RAISECHAR      14
-#define RECORD         15
-#define REMOTE         16
-#define SCRIPT         17
-#define TABEXPAND      18
-#define VERBOSE                19
-#define SHELL          20
-#define HOME           21
-#define ECHOCHECK      22
-#define DISCONNECT     23
-#define TAND           24
-#define LDELAY         25
-#define CDELAY         26
-#define ETIMEOUT       27
-#define RAWFTP         28
-#define HALFDUPLEX     29
-#define        LECHO           30
-#define        PARITY          31
-#endif
+#define LOG            11
+#define PHONES         12
+#define PROMPT         13
+#define RAISE          14
+#define RAISECHAR      15
+#define RECORD         16
+#define REMOTE         17
+#define SCRIPT         18
+#define TABEXPAND      19
+#define VERBOSE                20
+#define SHELL          21
+#define HOME           22
+#define ECHOCHECK      23
+#define DISCONNECT     24
+#define TAND           25
+#define LDELAY         26
+#define CDELAY         27
+#define ETIMEOUT       28
+#define RAWFTP         29
+#define HALFDUPLEX     30
+#define        LECHO           31
+#define        PARITY          32
 
 #define NOVAL  ((value_t *)NULL)
 #define NOACU  ((acu_t *)NULL)
 
 #define NOVAL  ((value_t *)NULL)
 #define NOACU  ((acu_t *)NULL)
@@ -229,6 +254,8 @@ int AC;                     /* open file descriptor to dialer (v831 only) */
 int    vflag;                  /* print .tiprc initialization sequence */
 int    sfd;                    /* for ~< operation */
 int    pid;                    /* pid of tipout */
 int    vflag;                  /* print .tiprc initialization sequence */
 int    sfd;                    /* for ~< operation */
 int    pid;                    /* pid of tipout */
+uid_t  uid, euid;              /* real and effective user id's */
+gid_t  gid, egid;              /* real and effective group id's */
 int    stop;                   /* stop transfer session flag */
 int    quit;                   /* same; but on other end */
 int    intflag;                /* recognized interrupt */
 int    stop;                   /* stop transfer session flag */
 int    quit;                   /* same; but on other end */
 int    intflag;                /* recognized interrupt */
@@ -242,40 +269,9 @@ char       ccc;                    /* synchronization character */
 char   ch;                     /* for tipout */
 char   *uucplock;              /* name of lock file for uucp's */
 
 char   ch;                     /* for tipout */
 char   *uucplock;              /* name of lock file for uucp's */
 
-/*
- * From <sys/tty.h> (PDP-11 V7) ... it's put in here to avoid lots
- *  of naming conflicts with stuff we have to pull in to use tty.h
- */
-#ifndef TIOCFLUSH
-#      define TIOCFLUSH        (('t'<<8)|16)
-#endif
-
-/*
- * On PDP-11 V7 systems with Rand's capacity call use this
- *  stuff, otherwise <assuming it's a VM system> use FIONREAD
- */
-#ifndef FIONREAD
-#define        FIOCAPACITY     (('f'<<8)|3)
-
-struct capacity {
-       off_t   cp_nbytes;
-       char    cp_eof;
-};
-#endif
-
-#ifdef VMUNIX
 int    odisc;                          /* initial tty line discipline */
 int    odisc;                          /* initial tty line discipline */
-extern int disc;                       /* current tty discpline */
-#endif
+extern int disc;                       /* current tty discpline */
 
 
-extern char            *ctrl();
-extern char            *ctime();
-extern long            time();
-extern struct passwd   *getpwuid();
-extern char            *getlogin();
-extern char            *vinterp();
-extern char            *getenv();
-extern char            *rindex();
-extern char            *index();
-extern char            *malloc();
-extern char            *connect();
+extern char *ctrl();
+extern char *vinterp();
+extern char *connect();