Phone numbers in the phones file end in ',' or '\n'.
[unix-history] / usr / src / usr.bin / tip / acu.c
index 4e416e3..d9c53eb 100644 (file)
@@ -1,6 +1,12 @@
+/*
+ * Copyright (c) 1983 Regents of the University of California.
+ * All rights reserved.  The Berkeley software License Agreement
+ * specifies the terms and conditions for redistribution.
+ */
+
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)acu.c      4.11 (Berkeley) %G%";
-#endif
+static char sccsid[] = "@(#)acu.c      5.3 (Berkeley) %G%";
+#endif not lint
 
 #include "tip.h"
 
 
 #include "tip.h"
 
@@ -35,7 +41,7 @@ connect()
 
        if (!DU) {              /* regular connect message */
                if (CM != NOSTR)
 
        if (!DU) {              /* regular connect message */
                if (CM != NOSTR)
-                       pwrite(FD, cp, size(CM));
+                       pwrite(FD, CM, size(CM));
                return (NOSTR);
        }
        /*
                return (NOSTR);
        }
        /*
@@ -63,7 +69,7 @@ connect()
                return ("unknown ACU type");
        if (*cp != '@') {
                while (*cp) {
                return ("unknown ACU type");
        if (*cp != '@') {
                while (*cp) {
-                       for (phnum = cp; any(*cp, "0123456789-*=K"); cp++)
+                       for (phnum = cp; *cp && *cp != ','; cp++)
                                ;
                        if (*cp)
                                *cp++ = '\0';
                                ;
                        if (*cp)
                                *cp++ = '\0';
@@ -98,9 +104,10 @@ connect()
                                fclose(fd);
                                return ("missing phone number");
                        }
                                fclose(fd);
                                return ("missing phone number");
                        }
-                       for (phnum = cp; any(*cp, "0123456789-*="); cp++)
+                       for (phnum = cp; *cp && *cp != ',' && *cp != '\n'; cp++)
                                ;
                                ;
-                       *cp = '\0';
+                       if (*cp)
+                               *cp++ = '\0';
                        
                        if (conflag = (*acu->acu_dialer)(phnum, CU)) {
                                fclose(fd);
                        
                        if (conflag = (*acu->acu_dialer)(phnum, CU)) {
                                fclose(fd);
@@ -126,7 +133,7 @@ disconnect(reason)
 {
        if (!conflag)
                return;
 {
        if (!conflag)
                return;
-       if (reason != NOSTR) {
+       if (reason == NOSTR) {
                logent(value(HOST), "", acu->acu_name, "call terminated");
                if (boolean(value(VERBOSE)))
                        printf("\r\ndisconnecting...");
                logent(value(HOST), "", acu->acu_name, "call terminated");
                if (boolean(value(VERBOSE)))
                        printf("\r\ndisconnecting...");