cleanup after "hw" attribute addition (instead of shannon mods)
authorSam Leffler <sam@ucbvax.Berkeley.EDU>
Sun, 12 Jul 1981 05:05:20 +0000 (21:05 -0800)
committerSam Leffler <sam@ucbvax.Berkeley.EDU>
Sun, 12 Jul 1981 05:05:20 +0000 (21:05 -0800)
SCCS-vsn: usr.bin/tip/cmds.c 4.5
SCCS-vsn: usr.bin/tip/aculib/dn11.c 4.6
SCCS-vsn: usr.bin/tip/remcap.c 4.4
SCCS-vsn: usr.bin/tip/tip.c 4.5
SCCS-vsn: usr.bin/tip/tip.h 4.4

usr/src/usr.bin/tip/aculib/dn11.c
usr/src/usr.bin/tip/cmds.c
usr/src/usr.bin/tip/remcap.c
usr/src/usr.bin/tip/tip.c
usr/src/usr.bin/tip/tip.h

index b426a9d..7446f5b 100644 (file)
@@ -1,4 +1,4 @@
-/*     dn11.c  4.5     81/06/21        */
+/*     dn11.c  4.6     81/07/11        */
 
 #if DN11
 /*
 
 #if DN11
 /*
@@ -26,7 +26,7 @@ char *num, *acu;
        if (boolean(value(VERBOSE)))
                printf("\nstarting call...");
        if ((dn = open(acu, 1)) < 0) {
        if (boolean(value(VERBOSE)))
                printf("\nstarting call...");
        if ((dn = open(acu, 1)) < 0) {
-               if (errno == ENXIO)
+               if (errno == EBUSY)
                        printf("line busy...");
                else
                        printf("acu open error...");
                        printf("line busy...");
                else
                        printf("acu open error...");
@@ -49,17 +49,12 @@ char *num, *acu;
                signal(SIGQUIT, SIG_IGN);
                sleep(2);
                nw = write(dn, num, lt = strlen(num));
                signal(SIGQUIT, SIG_IGN);
                sleep(2);
                nw = write(dn, num, lt = strlen(num));
-               if (nw != lt) {
-                       printf("dn11 write failed...");
-                       exit(1);
-               }
-               exit(0);
+               exit(nw != lt);
        }
        /*
         * open line - will return on carrier
         */
        }
        /*
         * open line - will return on carrier
         */
-       FD = open(DV, 2);
-       if (FD < 0) {
+       if ((FD = open(DV, 2)) < 0) {
                if (errno == EIO)
                        printf("lost carrier...");
                else
                if (errno == EIO)
                        printf("lost carrier...");
                else
index 7ce244d..ab0a3a6 100644 (file)
@@ -1,4 +1,4 @@
-/*     cmds.c  4.4     81/06/09        */
+/*     cmds.c  4.5     81/07/11        */
 #include "tip.h"
 /*
  * tip
 #include "tip.h"
 /*
  * tip
@@ -513,9 +513,6 @@ finish()
        disconnect();
        printf("\r\n[EOT]\r\n");
        delock(uucplock);
        disconnect();
        printf("\r\n[EOT]\r\n");
        delock(uucplock);
-#ifdef VMUNIX
-       ioctl(0, TIOCSETD, (char *)&odisc);
-#endif
        unraw();
        exit(0);
 }
        unraw();
        exit(0);
 }
index 1a21315..cebc8e6 100644 (file)
@@ -1,6 +1,8 @@
-/*     remcap.c        4.3     81/05/21        */
+/*     remcap.c        4.4     81/07/11        */
 /* 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>
index f2c3bbe..622748c 100644 (file)
@@ -1,4 +1,4 @@
-/*     tip.c   4.4     81/06/16        */
+/*     tip.c   4.5     81/07/11        */
 /*
  * tip - Unix link to other systems
  *  tip [-v] [-speed] system-name
 /*
  * tip - Unix link to other systems
  *  tip [-v] [-speed] system-name
@@ -58,6 +58,10 @@ int bauds[] = {
        1200, 1800, 2400, 4800, 9600, 19200, -1
 };
 
        1200, 1800, 2400, 4800, 9600, 19200, -1
 };
 
+#ifdef VMUNIX
+int    disc = OTTYDISC;                /* tip normally runs this way */
+#endif
+
 int    intprompt();
 int    timeout();
 static int cleanup();
 int    intprompt();
 int    timeout();
 static int cleanup();
@@ -67,9 +71,6 @@ char *argv[];
 {
        char *system = NOSTR;
        register int i;
 {
        char *system = NOSTR;
        register int i;
-#ifdef VMUNIX
-       int disc;
-#endif
        char *p;
 
        if (argc > 4) {
        char *p;
 
        if (argc > 4) {
@@ -123,41 +124,39 @@ char *argv[];
                        else
                                printf("%s: unknown option\n", argv[i]);
                }
                        else
                                printf("%s: unknown option\n", argv[i]);
                }
-       if ((arg.sg_ispeed = speed(number(value(BAUDRATE)))) == NULL) {
+       if ((i = speed(number(value(BAUDRATE)))) == NULL) {
                printf("tip: bad baud rate %d\n", number(value(BAUDRATE)));
                delock(uucplock);
                exit(3);
        }
 
                printf("tip: bad baud rate %d\n", number(value(BAUDRATE)));
                delock(uucplock);
                exit(3);
        }
 
+       /*
+        * Hardwired connections require the
+        *  line speed set before they make any transmissions
+        *  (this is particularly true of things like a DF03-AC)
+        */
+       if (HW)
+               ttysetup(i);
        if (p = connect()) {
                printf("\07%s\n[EOT]\n", p);
                delock(uucplock);
                exit(1);
        }
        if (p = connect()) {
                printf("\07%s\n[EOT]\n", p);
                delock(uucplock);
                exit(1);
        }
-       arg.sg_ospeed = arg.sg_ispeed;
+       if (!HW)
+               ttysetup(i);
+
        /*
        /*
-        * NOTE that remote side runs in TANDEM mode,
-        *  if the host doesn't honor X-ON/X-OFF with default
-        *  start/stop chars, the remote description must be
-        *  extended and tchars will have to be set up here.
-        * If the host doesn't honor TANDEM mode, then watch
-        *  out, as you'll get garbage.
+        * Set up local tty state
         */
         */
-       arg.sg_flags = RAW | TANDEM;
-       ioctl(FD, TIOCSETP, &arg);
-
-       ioctl(0, TIOCGETP, &defarg);    /* store initial status */
-       ioctl(0, TIOCGETC, &defchars);
+       ioctl(0, TIOCGETP, (char *)&defarg);
+       ioctl(0, TIOCGETC, (char *)&defchars);
+       ioctl(0, TIOCGETD, (char *)&odisc);
        arg = defarg;
        arg.sg_flags = ANYP | CBREAK;
        tchars = defchars;
        tchars.t_intrc = tchars.t_quitc = -1;
        raw();
        arg = defarg;
        arg.sg_flags = ANYP | CBREAK;
        tchars = defchars;
        tchars.t_intrc = tchars.t_quitc = -1;
        raw();
-#ifdef VMUNIX
-       ioctl(0, TIOCGETD, (char *)&odisc);
-       disc = OTTYDISC;
-       ioctl(0, TIOCSETD, (char *)&disc);
-#endif
+
        pipe(fildes); pipe(repdes);
        signal(SIGALRM, timeout);
 
        pipe(fildes); pipe(repdes);
        signal(SIGALRM, timeout);
 
@@ -194,6 +193,9 @@ raw()
 {
        ioctl(0, TIOCSETP, &arg);
        ioctl(0, TIOCSETC, &tchars);
 {
        ioctl(0, TIOCSETP, &arg);
        ioctl(0, TIOCSETC, &tchars);
+#ifdef VMUNIX
+       ioctl(0, TIOCSETD, (char *)&disc);
+#endif
 }
 
 
 }
 
 
@@ -202,8 +204,11 @@ raw()
  */
 unraw()
 {
  */
 unraw()
 {
-       ioctl(0, TIOCSETP, &defarg);
-       ioctl(0, TIOCSETC, &defchars);
+#ifdef VMUNIX
+       ioctl(0, TIOCSETD, (char *)&odisc);
+#endif
+       ioctl(0, TIOCSETP, (char *)&defarg);
+       ioctl(0, TIOCSETC, (char *)&defchars);
 }
 
 /*
 }
 
 /*
@@ -402,3 +407,21 @@ help(c)
                        p->e_flags&EXP ? '*': ' ', p->e_help);
        }
 }
                        p->e_flags&EXP ? '*': ' ', p->e_help);
        }
 }
+
+/*
+ * Set up the "remote" tty's state
+ */
+static
+ttysetup(speed)
+{
+#ifdef VMUNIX
+       unsigned bits = LDECCTQ;
+#endif
+
+       arg.sg_ispeed = arg.sg_ospeed = speed;
+       arg.sg_flags = TANDEM|RAW;
+       ioctl(FD, TIOCSETP, (char *)&arg);
+#ifdef VMUNIX
+       ioctl(FD, TIOCLBIS, (char *)&bits);
+#endif
+}
index 0e97ffc..e3bd701 100644 (file)
@@ -1,4 +1,4 @@
-/*     tip.h   4.3     81/06/16        */
+/*     tip.h   4.4     81/07/11        */
 /*
  * tip - terminal interface program
  *
 /*
  * tip - terminal interface program
  *
@@ -234,6 +234,7 @@ struct capacity {
 
 #ifdef VMUNIX
 int    odisc;                          /* initial tty line discipline */
 
 #ifdef VMUNIX
 int    odisc;                          /* initial tty line discipline */
+extern int disc;                       /* current tty discpline */
 #endif
 
 extern char            *ctrl();
 #endif
 
 extern char            *ctrl();