Replace sleep calls for 'wake up'.
[unix-history] / usr / src / usr.bin / tip / aculib / dn11.c
index 793864f..091ff51 100644 (file)
@@ -1,17 +1,13 @@
-/*     dn11.c  4.10    81/11/20        */
+#ifndef lint
+static char sccsid[] = "@(#)dn11.c     4.14 (Berkeley) %G%";
+#endif
 
 
-#if DN11
 /*
  * Routines for dialing up on DN-11
  */
 #include "tip.h"
 /*
  * Routines for dialing up on DN-11
  */
 #include "tip.h"
-#include <setjmp.h>
-#include <errno.h>
-
-int dn_abort();
-
-int alarmtr();
 
 
+int dn_abort(), alarmtr();
 static jmp_buf jmpbuf;
 static int child = -1, dn;
 
 static jmp_buf jmpbuf;
 static int child = -1, dn;
 
@@ -30,12 +26,12 @@ dn_dialer(num, acu)
                        printf("line busy...");
                else
                        printf("acu open error...");
                        printf("line busy...");
                else
                        printf("acu open error...");
-               return(0);
+               return (0);
        }
        if (setjmp(jmpbuf)) {
                kill(child, SIGKILL);
                close(dn);
        }
        if (setjmp(jmpbuf)) {
                kill(child, SIGKILL);
                close(dn);
-               return(0);
+               return (0);
        }
        signal(SIGALRM, alarmtr);
        timelim = 5 * strlen(num);
        }
        signal(SIGALRM, alarmtr);
        timelim = 5 * strlen(num);
@@ -47,25 +43,13 @@ dn_dialer(num, acu)
                signal(SIGALRM, SIG_IGN);
                signal(SIGINT, SIG_IGN);
                signal(SIGQUIT, SIG_IGN);
                signal(SIGALRM, SIG_IGN);
                signal(SIGINT, SIG_IGN);
                signal(SIGQUIT, SIG_IGN);
-#ifdef DEBUG
-               printf("child: sleep\n");
-#endif
                sleep(2);
                sleep(2);
-#ifdef DEBUG
-               printf("child: write\n");
-#endif
                nw = write(dn, num, lt = strlen(num));
                nw = write(dn, num, lt = strlen(num));
-#ifdef DEBUG
-               printf("child: write finished\n");
-#endif
                exit(nw != lt);
        }
        /*
         * open line - will return on carrier
         */
                exit(nw != lt);
        }
        /*
         * open line - will return on carrier
         */
-#ifdef DEBUG
-       printf("parent: child %d, open begin\n", child);
-#endif
        if ((FD = open(DV, 2)) < 0) {
                if (errno == EIO)
                        printf("lost carrier...");
        if ((FD = open(DV, 2)) < 0) {
                if (errno == EIO)
                        printf("lost carrier...");
@@ -74,33 +58,25 @@ dn_dialer(num, acu)
                alarm(0);
                kill(child, SIGKILL);
                close(dn);
                alarm(0);
                kill(child, SIGKILL);
                close(dn);
-               return(0);
+               return (0);
        }
        alarm(0);
        }
        alarm(0);
-#ifdef DEBUG
-       printf("parent: open finished\n");
-#endif
        ioctl(dn, TIOCHPCL, 0);
        signal(SIGALRM, SIG_DFL);
        ioctl(dn, TIOCHPCL, 0);
        signal(SIGALRM, SIG_DFL);
-#ifdef DEBUG
-       printf("parent: wait for child\n");
-#endif
        while ((nw = wait(&lt)) != child && nw != -1)
        while ((nw = wait(&lt)) != child && nw != -1)
-#ifdef DEBUG
-               printf("wait finds child with pid %d\n", nw)
-#endif
                ;
        fflush(stdout);
        close(dn);
        if (lt != 0) {
                close(FD);
                ;
        fflush(stdout);
        close(dn);
        if (lt != 0) {
                close(FD);
-               return(0);
+               return (0);
        }
        }
-       return(1);
+       return (1);
 }
 
 alarmtr()
 {
 }
 
 alarmtr()
 {
+
        alarm(0);
        longjmp(jmpbuf, 1);
 }
        alarm(0);
        longjmp(jmpbuf, 1);
 }
@@ -111,25 +87,22 @@ alarmtr()
  */
 dn_disconnect()
 {
  */
 dn_disconnect()
 {
+
        sleep(2);
        sleep(2);
-#ifdef VMUNIX
        if (FD > 0)
                ioctl(FD, TIOCCDTR, 0);
        if (FD > 0)
                ioctl(FD, TIOCCDTR, 0);
-#endif
        close(FD);
 }
 
 dn_abort()
 {
        close(FD);
 }
 
 dn_abort()
 {
+
        sleep(2);
        if (child > 0)
                kill(child, SIGKILL);
        if (dn > 0)
                close(dn);
        sleep(2);
        if (child > 0)
                kill(child, SIGKILL);
        if (dn > 0)
                close(dn);
-#ifdef VMUNIX
        if (FD > 0)
                ioctl(FD, TIOCCDTR, 0);
        if (FD > 0)
                ioctl(FD, TIOCCDTR, 0);
-#endif
        close(FD);
 }
        close(FD);
 }
-#endif