aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/tip/libacu/v3451.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/tip/libacu/v3451.c')
-rw-r--r--usr.bin/tip/libacu/v3451.c62
1 files changed, 35 insertions, 27 deletions
diff --git a/usr.bin/tip/libacu/v3451.c b/usr.bin/tip/libacu/v3451.c
index a98c4d4924b7..df850a5364b3 100644
--- a/usr.bin/tip/libacu/v3451.c
+++ b/usr.bin/tip/libacu/v3451.c
@@ -1,3 +1,6 @@
+/* $OpenBSD: v3451.c,v 1.6 2001/10/24 18:38:58 millert Exp $ */
+/* $NetBSD: v3451.c,v 1.6 1997/02/11 09:24:20 mrg Exp $ */
+
/*
* Copyright (c) 1983, 1993
* The Regents of the University of California. All rights reserved.
@@ -31,31 +34,36 @@
* SUCH DAMAGE.
*/
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#ifndef lint
+#if 0
static char sccsid[] = "@(#)v3451.c 8.1 (Berkeley) 6/6/93";
+static char rcsid[] = "$OpenBSD: v3451.c,v 1.6 2001/10/24 18:38:58 millert Exp $";
+#endif
#endif /* not lint */
/*
* Routines for calling up on a Vadic 3451 Modem
*/
-#include "tipconf.h"
#include "tip.h"
static jmp_buf Sjbuf;
+static int expect(), notin(), prefix();
+static void vawrite(), alarmtr();
+
+int
v3451_dialer(num, acu)
- register char *num;
+ char *num;
char *acu;
{
sig_t func;
int ok;
- int slow = number(value(BAUDRATE)) < 1200, rw = 2;
+ int slow = number(value(BAUDRATE)) < 1200;
char phone[50];
-#if ACULOG
- char line[80];
-#endif
- static int expect();
- static void vawrite();
+ struct termios cntrl;
/*
* Get in synch
@@ -66,27 +74,28 @@ v3451_dialer(num, acu)
vawrite("\005\r", 2 + slow);
if (!expect("READY")) {
printf("can't synchronize with vadic 3451\n");
-#if ACULOG
+#ifdef ACULOG
logent(value(HOST), num, "vadic", "can't synch up");
#endif
return (0);
}
- acu_hupcl ();
+ tcgetattr(FD, &cntrl);
+ term.c_cflag |= HUPCL;
+ tcsetattr(FD, TCSANOW, &cntrl);
sleep(1);
vawrite("D\r", 2 + slow);
if (!expect("NUMBER?")) {
printf("Vadic will not accept dial command\n");
-#if ACULOG
+#ifdef ACULOG
logent(value(HOST), num, "vadic", "will not accept dial");
#endif
return (0);
}
- strcpy(phone, num);
- strcat(phone, "\r");
+ (void)snprintf(phone, sizeof phone, "%s\r", num);
vawrite(phone, 1 + slow);
if (!expect(phone)) {
printf("Vadic will not accept phone number\n");
-#if ACULOG
+#ifdef ACULOG
logent(value(HOST), num, "vadic", "will not accept number");
#endif
return (0);
@@ -101,7 +110,7 @@ v3451_dialer(num, acu)
vawrite("\r", 1 + slow);
if (!expect("DIALING:")) {
printf("Vadic failed to dial\n");
-#if ACULOG
+#ifdef ACULOG
logent(value(HOST), num, "vadic", "failed to dial");
#endif
return (0);
@@ -112,21 +121,23 @@ v3451_dialer(num, acu)
signal(SIGINT, func);
if (!ok) {
printf("call failed\n");
-#if ACULOG
+#ifdef ACULOG
logent(value(HOST), num, "vadic", "call failed");
#endif
return (0);
}
- ioctl(FD, TIOCFLUSH, &rw);
+ tcflush(FD, TCIOFLUSH);
return (1);
}
+void
v3451_disconnect()
{
close(FD);
}
+void
v3451_abort()
{
@@ -135,7 +146,7 @@ v3451_abort()
static void
vawrite(cp, delay)
- register char *cp;
+ char *cp;
int delay;
{
@@ -143,15 +154,13 @@ vawrite(cp, delay)
write(FD, cp, 1);
}
-static
+static int
expect(cp)
- register char *cp;
+ char *cp;
{
char buf[300];
- register char *rp = buf;
+ char *rp = buf;
int timeout = 30, online = 0;
- static int notin();
- static void alarmtr();
if (strcmp(cp, "\"\"") == 0)
return (1);
@@ -194,7 +203,6 @@ static int
notin(sh, lg)
char *sh, *lg;
{
- static int prefix();
for (; *lg; lg++)
if (prefix(sh, lg))
@@ -202,11 +210,11 @@ notin(sh, lg)
return (1);
}
-static
+static int
prefix(s1, s2)
- register char *s1, *s2;
+ char *s1, *s2;
{
- register char c;
+ char c;
while ((c = *s1++) == *s2++)
if (c == '\0')