BSD 4_1c_2 release
[unix-history] / usr / src / usr.bin / tip / remote.c
index b936561..76cdff9 100644 (file)
@@ -1,4 +1,4 @@
-/*     remote.c        4.1     81/05/09        */
+/*     remote.c        4.5     81/11/29        */
 # include "tip.h"
 
 /*
 # include "tip.h"
 
 /*
@@ -33,12 +33,16 @@ getremcap(host)
        }
 
        for (p = capstrings, q = caps; *p != NULL; p++, q++)
        }
 
        for (p = capstrings, q = caps; *p != NULL; p++, q++)
-               **q = rgetstr(*p, &bp);
-       if ((BR = rgetnum("br")) < 0)
+               if (**q == NULL)
+                       **q = rgetstr(*p, &bp);
+       if (!BR && (BR = rgetnum("br")) < 0)
                BR = DEFBR;
        if ((FS = rgetnum("fs")) < 0)
                FS = DEFFS;
                BR = DEFBR;
        if ((FS = rgetnum("fs")) < 0)
                FS = DEFFS;
-       DU = rgetflag("du");
+       if (DU < 0)
+               DU = 0;
+       else
+               DU = rgetflag("du");
        if (DV == NOSTR) {
                fprintf(stderr, "%s: missing device spec\n", host);
                exit(3);
        if (DV == NOSTR) {
                fprintf(stderr, "%s: missing device spec\n", host);
                exit(3);
@@ -49,6 +53,12 @@ getremcap(host)
                fprintf(stderr, "%s: missing phone number\n", host);
                exit(3);
        }
                fprintf(stderr, "%s: missing phone number\n", host);
                exit(3);
        }
+       /*
+        * This effectively eliminates the "hw" attribute
+        *   from the description file
+        */
+       if (!HW)
+               HW = (CU == NOSTR) || (DU && equal(DV, CU));
        HO = host;
 }
 
        HO = host;
 }
 
@@ -74,7 +84,7 @@ getremote(host)
         *   a rotary action to be simulated)
         */
        if (next == NOSTR)
         *   a rotary action to be simulated)
         */
        if (next == NOSTR)
-               return(NOSTR);
+               return (NOSTR);
        if ((cp = index(next, ',')) == NULL) {
                DV = next;
                next = NOSTR;
        if ((cp = index(next, ',')) == NULL) {
                DV = next;
                next = NOSTR;
@@ -83,5 +93,5 @@ getremote(host)
                DV = next;
                next = cp;
        }
                DV = next;
                next = cp;
        }
-       return(DV);
+       return (DV);
 }
 }