added PDX constant
[unix-history] / usr / src / usr.bin / tip / remcap.c
index 38a81cd..ff385a8 100644 (file)
@@ -1,10 +1,14 @@
-/*     remcap.c        4.2     81/05/20        */
+/*     remcap.c        4.6     81/11/29        */
 /* Copyright (c) 1979 Regents of the University of California */
 /* Copyright (c) 1979 Regents of the University of California */
+#ifndef BUFSIZ
 #define        BUFSIZ  1024
 #define        BUFSIZ  1024
+#endif
 #define MAXHOP 32      /* max number of tc= indirections */
 
 #include <ctype.h>
 #define MAXHOP 32      /* max number of tc= indirections */
 
 #include <ctype.h>
+#ifdef VMUNIX
 #include "local/uparm.h"
 #include "local/uparm.h"
+#endif
 /*
  * remcap - routines for dealing with the remote host data base
  *
 /*
  * remcap - routines for dealing with the remote host data base
  *
 #define        tgetflag        rgetflag
 #define        tgetstr         rgetstr
 #undef E_TERMCAP
 #define        tgetflag        rgetflag
 #define        tgetstr         rgetstr
 #undef E_TERMCAP
-#define        E_TERMCAP       "/etc/remote"
-#define        V6              /* don't look in environment */
+#define        E_TERMCAP       RM = "/etc/remote"
+#define V_TERMCAP      "REMOTE"
+#define V_TERM         "HOST"
+
 char   *RM;
 char   *RM;
+#else
+#define        V_TERMCAP       "TERMCAP"
+#define V_TERM         "TERM"
 #endif
 
 /*
 #endif
 
 /*
@@ -64,7 +73,7 @@ tgetent(bp, name)
        tbuf = bp;
        tf = 0;
 #ifndef V6
        tbuf = bp;
        tf = 0;
 #ifndef V6
-       cp = getenv("TERMCAP");
+       cp = getenv(V_TERMCAP);
        /*
         * TERMCAP can have one of two things in it. It can be the
         * name of a file to use instead of /etc/termcap. In this
        /*
         * TERMCAP can have one of two things in it. It can be the
         * name of a file to use instead of /etc/termcap. In this
@@ -74,7 +83,7 @@ tgetent(bp, name)
         */
        if (cp && *cp) {
                if (*cp!='/') {
         */
        if (cp && *cp) {
                if (*cp!='/') {
-                       cp2 = getenv("TERM");
+                       cp2 = getenv(V_TERM);
                        if (cp2==(char *) 0 || strcmp(name,cp2)==0) {
                                strcpy(bp,cp);
                                return(tnchktc());
                        if (cp2==(char *) 0 || strcmp(name,cp2)==0) {
                                strcpy(bp,cp);
                                return(tnchktc());
@@ -82,16 +91,15 @@ tgetent(bp, name)
                                tf = open(E_TERMCAP, 0);
                        }
                } else
                                tf = open(E_TERMCAP, 0);
                        }
                } else
+#ifdef REMOTE
+                       tf = open(RM = cp, 0);
+#else
                        tf = open(cp, 0);
                        tf = open(cp, 0);
+#endif
        }
        if (tf==0)
                tf = open(E_TERMCAP, 0);
 #else
        }
        if (tf==0)
                tf = open(E_TERMCAP, 0);
 #else
-#ifdef REMOTE
-       if ((RM = getenv("REMOTE")) == (char *)0)
-               RM = E_TERMCAP;
-       tf = open(RM, 0);
-#endif
        tf = open(E_TERMCAP, 0);
 #endif
        if (tf < 0)
        tf = open(E_TERMCAP, 0);
 #endif
        if (tf < 0)