-/* acu.c 4.7 82/07/29 */
+/*
+ * 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
+static char sccsid[] = "@(#)acu.c 5.5 (Berkeley) 12/4/87";
+#endif not lint
+
#include "tip.h"
-#include <setjmp.h>
static acu_t *acu = NOACU;
static int conflag;
if (!DU) { /* regular connect message */
if (CM != NOSTR)
- write(FD, cp, size(CM));
+ pwrite(FD, CM, size(CM));
+ logent(value(HOST), "", DV, "call completed");
return (NOSTR);
}
/*
if (acu != NOACU) {
boolean(value(VERBOSE)) = FALSE;
if (conflag)
- disconnect();
+ disconnect(NOSTR);
else
(*acu->acu_abort)();
}
- delock(uucplock);
- exit(1);
+ return ("interrupt");
}
if ((acu = acutype(AT)) == NOACU)
return ("unknown ACU type");
if (*cp != '@') {
while (*cp) {
- for (phnum = cp; any(*cp, "0123456789-*=&%"); cp++)
+ for (phnum = cp; *cp && *cp != ','; cp++)
;
if (*cp)
*cp++ = '\0';
return (NOSTR);
} else
logent(value(HOST), phnum, acu->acu_name,
- "no answer");
+ "call failed");
tried++;
}
} else {
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);
return (NOSTR);
} else
logent(value(HOST), phnum, acu->acu_name,
- "no answer");
+ "call failed");
tried++;
}
fclose(fd);
}
if (!tried)
logent(value(HOST), "", acu->acu_name, "missing phone number");
- return (tried ? "no answer" : "missing phone number");
+ else
+ (*acu->acu_abort)();
+ return (tried ? "call failed" : "missing phone number");
}
-disconnect()
+disconnect(reason)
+ char *reason;
{
- if (!conflag)
+ if (!conflag) {
+ logent(value(HOST), "", DV, "call terminated");
return;
- logent(value(HOST), "", acu->acu_name, "call terminated");
- if (boolean(value(VERBOSE)))
- printf("\r\ndisconnecting...");
+ }
+ if (reason == NOSTR) {
+ logent(value(HOST), "", acu->acu_name, "call terminated");
+ if (boolean(value(VERBOSE)))
+ printf("\r\ndisconnecting...");
+ } else
+ logent(value(HOST), "", acu->acu_name, reason);
(*acu->acu_disconnect)();
}