changed INDEX operator to handle multiple subscript arrays correctly
[unix-history] / usr / src / usr.bin / tip / aculib / biz31.c
index aea769f..1c76e0b 100644 (file)
@@ -1,7 +1,7 @@
-/*     biz31.c 4.1     81/05/09        */
+/*     biz31.c 4.4     81/11/29        */
 #include "tip.h"
 
 #include "tip.h"
 
-#if BIZCOMP
+#if BIZ1031
 #define MAXRETRY       3               /* sync up retry count */
 #define DISCONNECT     "\21\25\11\24"  /* disconnection string */
 
 #define MAXRETRY       3               /* sync up retry count */
 #define DISCONNECT     "\21\25\11\24"  /* disconnection string */
 
@@ -9,13 +9,13 @@ static int sigALRM();
 static int timeout = 0;
 
 /*
 static int timeout = 0;
 
 /*
- * Dial up on a BIZCOMP with either
+ * Dial up on a BIZCOMP Model 1031 with either
  *     tone dialing (mod = "f")
  *     pulse dialing (mod = "w")
  */
 static int
 biz_dialer(num, mod)
  *     tone dialing (mod = "f")
  *     pulse dialing (mod = "w")
  */
 static int
 biz_dialer(num, mod)
-char *num, *mod;
+       char *num, *mod;
 {
        register int connected = 0;
 
 {
        register int connected = 0;
 
@@ -59,30 +59,30 @@ char *num, *mod;
        else
                flush("CONNECTION\r\n\07");
        if (timeout)
        else
                flush("CONNECTION\r\n\07");
        if (timeout)
-               biz_disconnect();       /* insurance */
-       return(connected);
+               biz31_disconnect();     /* insurance */
+       return (connected);
 }
 
 }
 
-bizw_dialer(num, acu)
-char *num, *acu;
+biz31w_dialer(num, acu)
+       char *num, *acu;
 {
 {
-       return(biz_dialer(num, "w"));
+       return (biz_dialer(num, "w"));
 }
 
 }
 
-bizf_dialer(num, acu)
-char *num, *acu;
+biz31f_dialer(num, acu)
+       char *num, *acu;
 {
 {
-       return(biz_dialer(num, "f"));
+       return (biz_dialer(num, "f"));
 }
 
 }
 
-biz_disconnect()
+biz31_disconnect()
 {
        write(FD, DISCONNECT, 4);
        sleep(2);
        ioctl(FD, TIOCFLUSH);
 }
 
 {
        write(FD, DISCONNECT, 4);
        sleep(2);
        ioctl(FD, TIOCFLUSH);
 }
 
-biz_abort()
+biz31_abort()
 {
        write(FD, "\33", 1);
        timeout = 1;
 {
        write(FD, "\33", 1);
        timeout = 1;
@@ -90,25 +90,26 @@ biz_abort()
 
 static int
 echo(s)
 
 static int
 echo(s)
-register char *s;
+       register char *s;
 {
        char c;
 
 {
        char c;
 
-       while (c = *s++)
-               switch(c)
-               {
-                       case '$':
-                               read(FD, &c, 1);
-                               s++;
-                               break;
-                       case '#':
-                               c = *s++;
-                               write(FD, &c, 1);
-                               break;
-                       default:
-                               write(FD, &c, 1);
-                               read(FD, &c, 1);
-               }
+       while (c = *s++) switch (c) {
+
+       case '$':
+               read(FD, &c, 1);
+               s++;
+               break;
+
+       case '#':
+               c = *s++;
+               write(FD, &c, 1);
+               break;
+
+       default:
+               write(FD, &c, 1);
+               read(FD, &c, 1);
+       }
 }
 
 static int
 }
 
 static int
@@ -121,36 +122,34 @@ sigALRM()
 
 static int
 detect(s)
 
 static int
 detect(s)
-register char *s;
+       register char *s;
 {
        char c;
 
 {
        char c;
 
-       signal(SIGALRM, biz_abort);
+       signal(SIGALRM, biz31_abort);
        timeout = 0;
        timeout = 0;
-       while (*s)
-       {
+       while (*s) {
                alarm(number(value(DIALTIMEOUT)));
                read(FD, &c, 1);
                alarm(0);
                if (timeout)
                alarm(number(value(DIALTIMEOUT)));
                read(FD, &c, 1);
                alarm(0);
                if (timeout)
-                       return(0);
+                       return (0);
                if (c != *s++)
                if (c != *s++)
-                       return(0);
+                       return (0);
        }
        signal(SIGALRM, SIG_DFL);
        }
        signal(SIGALRM, SIG_DFL);
-       return(1);
+       return (1);
 }
 
 static int
 flush(s)
 }
 
 static int
 flush(s)
-register char *s;
+       register char *s;
 {
        char c;
 
        signal(SIGALRM, sigALRM);
        timeout = 0;
 {
        char c;
 
        signal(SIGALRM, sigALRM);
        timeout = 0;
-       while (*s++)
-       {
+       while (*s++) {
                alarm(10);
                read(FD, &c, 1);
                alarm(0);
                alarm(10);
                read(FD, &c, 1);
                alarm(0);
@@ -159,7 +158,7 @@ register char *s;
        }
        signal(SIGALRM, SIG_DFL);
        timeout = 0;                    /* guard against disconnection */
        }
        signal(SIGALRM, SIG_DFL);
        timeout = 0;                    /* guard against disconnection */
-       return(1);
+       return (1);
 }
 
 /*
 }
 
 /*
@@ -192,7 +191,7 @@ retry:
                if (chars(b) != 10) {
        nono:
                        if (already > MAXRETRY)
                if (chars(b) != 10) {
        nono:
                        if (already > MAXRETRY)
-                               return(0);
+                               return (0);
                        write(fd, DISCONNECT, 4);
                        sleep(2);
                        already++;
                        write(fd, DISCONNECT, 4);
                        sleep(2);
                        already++;
@@ -203,6 +202,6 @@ retry:
                                goto nono;
                }
        }
                                goto nono;
                }
        }
-       return(1);
+       return (1);
 }
 #endif
 }
 #endif