summaryrefslogtreecommitdiff
path: root/usr.bin/tip/aculib
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/tip/aculib')
-rw-r--r--usr.bin/tip/aculib/biz22.c6
-rw-r--r--usr.bin/tip/aculib/biz31.c8
-rw-r--r--usr.bin/tip/aculib/courier.c37
-rw-r--r--usr.bin/tip/aculib/df.c32
-rw-r--r--usr.bin/tip/aculib/dn11.c9
-rw-r--r--usr.bin/tip/aculib/hayes.c22
-rw-r--r--usr.bin/tip/aculib/t3000.c49
-rw-r--r--usr.bin/tip/aculib/v3451.c11
-rw-r--r--usr.bin/tip/aculib/v831.c35
-rw-r--r--usr.bin/tip/aculib/ventel.c13
10 files changed, 114 insertions, 108 deletions
diff --git a/usr.bin/tip/aculib/biz22.c b/usr.bin/tip/aculib/biz22.c
index db9e8da3ca8..165ce59dd69 100644
--- a/usr.bin/tip/aculib/biz22.c
+++ b/usr.bin/tip/aculib/biz22.c
@@ -1,4 +1,4 @@
-/* $NetBSD: biz22.c,v 1.3 1994/12/08 09:31:31 jtc Exp $ */
+/* $NetBSD: biz22.c,v 1.4 1995/10/29 00:49:47 pk Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)biz22.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$NetBSD: biz22.c,v 1.3 1994/12/08 09:31:31 jtc Exp $";
+static char rcsid[] = "$NetBSD: biz22.c,v 1.4 1995/10/29 00:49:47 pk Exp $";
#endif /* not lint */
#include "tip.h"
@@ -127,7 +127,7 @@ biz22_disconnect()
write(FD, DISCONNECT_CMD, 4);
sleep(2);
- ioctl(FD, TIOCFLUSH, &rw);
+ tcflush(FD, TCIOFLUSH);
}
biz22_abort()
diff --git a/usr.bin/tip/aculib/biz31.c b/usr.bin/tip/aculib/biz31.c
index 15185cd58a4..a82c6282ee8 100644
--- a/usr.bin/tip/aculib/biz31.c
+++ b/usr.bin/tip/aculib/biz31.c
@@ -1,4 +1,4 @@
-/* $NetBSD: biz31.c,v 1.3 1994/12/08 09:31:33 jtc Exp $ */
+/* $NetBSD: biz31.c,v 1.4 1995/10/29 00:49:48 pk Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)biz31.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$NetBSD: biz31.c,v 1.3 1994/12/08 09:31:33 jtc Exp $";
+static char rcsid[] = "$NetBSD: biz31.c,v 1.4 1995/10/29 00:49:48 pk Exp $";
#endif /* not lint */
#include "tip.h"
@@ -123,7 +123,7 @@ biz31_disconnect()
write(FD, DISCONNECT_CMD, 4);
sleep(2);
- ioctl(FD, TIOCFLUSH);
+ tcflush(FD, TCIOFLUSH);
}
biz31_abort()
@@ -231,7 +231,7 @@ bizsync(fd)
retry:
if (ioctl(fd, IOCTL, (caddr_t)&b) >= 0 && chars(b) > 0)
- ioctl(fd, TIOCFLUSH);
+ tcflush(FD, TCIOFLUSH);
write(fd, "\rp>\r", 4);
sleep(1);
if (ioctl(fd, IOCTL, (caddr_t)&b) >= 0) {
diff --git a/usr.bin/tip/aculib/courier.c b/usr.bin/tip/aculib/courier.c
index fbf56b99a55..57f14f149e8 100644
--- a/usr.bin/tip/aculib/courier.c
+++ b/usr.bin/tip/aculib/courier.c
@@ -1,4 +1,4 @@
-/* $NetBSD: courier.c,v 1.4 1994/12/08 09:31:35 jtc Exp $ */
+/* $NetBSD: courier.c,v 1.5 1995/10/29 00:49:50 pk Exp $ */
/*
* Copyright (c) 1986, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)courier.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$NetBSD: courier.c,v 1.4 1994/12/08 09:31:35 jtc Exp $";
+static char rcsid[] = "$NetBSD: courier.c,v 1.5 1995/10/29 00:49:50 pk Exp $";
#endif /* not lint */
/*
@@ -45,6 +45,7 @@ static char rcsid[] = "$NetBSD: courier.c,v 1.4 1994/12/08 09:31:35 jtc Exp $";
* Derived from Hayes driver.
*/
#include "tip.h"
+#include <sys/ioctl.h>
#include <stdio.h>
#define MAXRETRY 5
@@ -63,12 +64,15 @@ cour_dialer(num, acu)
#ifdef ACULOG
char line[80];
#endif
+ struct termios cntrl;
static int cour_connect(), cour_swallow();
if (boolean(value(VERBOSE)))
printf("Using \"%s\"\n", acu);
- ioctl(FD, TIOCHPCL, 0);
+ tcgetattr(FD, &cntrl);
+ cntrl.c_cflag |= HUPCL;
+ tcsetattr(FD, TCSAFLUSH, &cntrl);
/*
* Get in synch.
*/
@@ -86,7 +90,7 @@ badsynch:
if (boolean(value(VERBOSE)))
cour_verbose_read();
#endif
- ioctl(FD, TIOCFLUSH, 0); /* flush any clutter */
+ tcflush(FD, TCIOFLUSH);
cour_write(FD, "AT C1 E0 H0 Q0 X6 V1\r", 21);
if (!cour_swallow("\r\nOK\r\n"))
goto badsynch;
@@ -186,7 +190,6 @@ cour_connect()
{
char c;
int nc, nl, n;
- struct sgttyb sb;
char dialer_buf[64];
struct baud_msg *bm;
sig_t f;
@@ -225,15 +228,12 @@ again:
for (bm = baud_msg ; bm->msg ; bm++)
if (strcmp(bm->msg,
dialer_buf+sizeof("CONNECT")-1) == 0) {
- if (ioctl(FD, TIOCGETP, &sb) < 0) {
- perror("TIOCGETP");
- goto error;
- }
- sb.sg_ispeed = sb.sg_ospeed = bm->baud;
- if (ioctl(FD, TIOCSETP, &sb) < 0) {
- perror("TIOCSETP");
- goto error;
- }
+ struct termios cntrl;
+
+ tcgetattr(FD, &cntrl);
+ cfsetospeed(&cntrl, bm->baud);
+ cfsetispeed(&cntrl, bm->baud);
+ tcsetattr(FD, TCSAFLUSH, &cntrl);
signal(SIGALRM, f);
#ifdef DEBUG
if (boolean(value(VERBOSE)))
@@ -268,7 +268,7 @@ coursync()
char buf[40];
while (already++ < MAXRETRY) {
- ioctl(FD, TIOCFLUSH, 0); /* flush any clutter */
+ tcflush(FD, TCIOFLUSH);
cour_write(FD, "\rAT Z\r", 6); /* reset modem */
bzero(buf, sizeof(buf));
sleep(1);
@@ -307,18 +307,15 @@ int fd;
char *cp;
int n;
{
- struct sgttyb sb;
#ifdef notdef
if (boolean(value(VERBOSE)))
write(1, cp, n);
#endif
- ioctl(fd, TIOCGETP, &sb);
- ioctl(fd, TIOCSETP, &sb);
+ tcdrain(fd);
cour_nap();
for ( ; n-- ; cp++) {
write(fd, cp, 1);
- ioctl(fd, TIOCGETP, &sb);
- ioctl(fd, TIOCSETP, &sb);
+ tcdrain(fd);
cour_nap();
}
}
diff --git a/usr.bin/tip/aculib/df.c b/usr.bin/tip/aculib/df.c
index bc843d7291d..f0581e63c7a 100644
--- a/usr.bin/tip/aculib/df.c
+++ b/usr.bin/tip/aculib/df.c
@@ -1,4 +1,4 @@
-/* $NetBSD: df.c,v 1.3 1994/12/08 09:31:38 jtc Exp $ */
+/* $NetBSD: df.c,v 1.4 1995/10/29 00:49:51 pk Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)df.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$NetBSD: df.c,v 1.3 1994/12/08 09:31:38 jtc Exp $";
+static char rcsid[] = "$NetBSD: df.c,v 1.4 1995/10/29 00:49:51 pk Exp $";
#endif /* not lint */
/*
@@ -68,11 +68,13 @@ df_dialer(num, acu, df03)
int df03;
{
register int f = FD;
- struct sgttyb buf;
+ struct termios cntrl;
int speed = 0, rw = 2;
char c = '\0';
- ioctl(f, TIOCHPCL, 0); /* make sure it hangs up when done */
+ tcgetattr(f, &cntrl);
+ cntrl.c_cflag |= HUPCL;
+ tcsetattr(f, TCSANOW, &cntrl);
if (setjmp(Sjbuf)) {
printf("connection timed out\r\n");
df_disconnect();
@@ -85,11 +87,12 @@ df_dialer(num, acu, df03)
if (df03) {
int st = TIOCM_ST; /* secondary Transmit flag */
- ioctl(f, TIOCGETP, &buf);
- if (buf.sg_ospeed != B1200) { /* must dial at 1200 baud */
- speed = buf.sg_ospeed;
- buf.sg_ospeed = buf.sg_ispeed = B1200;
- ioctl(f, TIOCSETP, &buf);
+ tcgetattr(f, &cntrl);
+ speed = cfgetospeed(&cntrl);
+ if (speed != B1200) { /* must dial at 1200 baud */
+ cfsetospeed(&cntrl, B1200);
+ cfsetispeed(&cntrl, B1200);
+ tcsetattr(f, TCSAFLUSH, &cntrl);
ioctl(f, TIOCMBIC, &st); /* clear ST for 300 baud */
} else
ioctl(f, TIOCMBIS, &st); /* set ST for 1200 baud */
@@ -97,16 +100,17 @@ df_dialer(num, acu, df03)
#endif
signal(SIGALRM, timeout);
alarm(5 * strlen(num) + 10);
- ioctl(f, TIOCFLUSH, &rw);
+ tcflush(f, TCIOFLUSH);
write(f, "\001", 1);
sleep(1);
write(f, "\002", 1);
write(f, num, strlen(num));
read(f, &c, 1);
#ifdef TIOCMSET
- if (df03 && speed) {
- buf.sg_ispeed = buf.sg_ospeed = speed;
- ioctl(f, TIOCSETP, &buf);
+ if (df03 && speed != B1200) {
+ cfsetospeed(&cntrl, speed);
+ cfsetispeed(&cntrl, speed);
+ tcsetattr(f, TCSAFLUSH, &cntrl);
}
#endif
return (c == 'A');
@@ -118,7 +122,7 @@ df_disconnect()
write(FD, "\001", 1);
sleep(1);
- ioctl(FD, TIOCFLUSH, &rw);
+ tcflush(FD, TCIOFLUSH);
}
diff --git a/usr.bin/tip/aculib/dn11.c b/usr.bin/tip/aculib/dn11.c
index d310deb723b..37d97618d64 100644
--- a/usr.bin/tip/aculib/dn11.c
+++ b/usr.bin/tip/aculib/dn11.c
@@ -1,4 +1,4 @@
-/* $NetBSD: dn11.c,v 1.3 1994/12/08 09:31:40 jtc Exp $ */
+/* $NetBSD: dn11.c,v 1.4 1995/10/29 00:49:53 pk Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)dn11.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$NetBSD: dn11.c,v 1.3 1994/12/08 09:31:40 jtc Exp $";
+static char rcsid[] = "$NetBSD: dn11.c,v 1.4 1995/10/29 00:49:53 pk Exp $";
#endif /* not lint */
/*
@@ -57,6 +57,7 @@ dn_dialer(num, acu)
char *p, *q, phone[40];
int lt, nw, connected = 1;
register int timelim;
+ struct termios cntrl;
if (boolean(value(VERBOSE)))
printf("\nstarting call...");
@@ -100,7 +101,9 @@ dn_dialer(num, acu)
return (0);
}
alarm(0);
- ioctl(dn, TIOCHPCL, 0);
+ tcgetattr(dn, &cntrl);
+ cntrl.c_cflag |= HUPCL;
+ tcsetattr(dn, TCSANOW, &cntrl);
signal(SIGALRM, SIG_DFL);
while ((nw = wait(&lt)) != child && nw != -1)
;
diff --git a/usr.bin/tip/aculib/hayes.c b/usr.bin/tip/aculib/hayes.c
index a35256fe318..d8ff831e587 100644
--- a/usr.bin/tip/aculib/hayes.c
+++ b/usr.bin/tip/aculib/hayes.c
@@ -1,4 +1,4 @@
-/* $NetBSD: hayes.c,v 1.3 1994/12/08 09:31:42 jtc Exp $ */
+/* $NetBSD: hayes.c,v 1.4 1995/10/29 00:49:54 pk Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)hayes.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$NetBSD: hayes.c,v 1.3 1994/12/08 09:31:42 jtc Exp $";
+static char rcsid[] = "$NetBSD: hayes.c,v 1.4 1995/10/29 00:49:54 pk Exp $";
#endif /* not lint */
/*
@@ -65,6 +65,9 @@ static char rcsid[] = "$NetBSD: hayes.c,v 1.3 1994/12/08 09:31:42 jtc Exp $";
*/
#include "tip.h"
+#include <termios.h>
+#include <sys/ioctl.h>
+
#define min(a,b) ((a < b) ? a : b)
static void sigALRM();
@@ -87,6 +90,7 @@ hay_dialer(num, acu)
register char *cp;
register int connected = 0;
char dummy;
+ struct termios cntrl;
#ifdef ACULOG
char line[80];
#endif
@@ -95,8 +99,10 @@ hay_dialer(num, acu)
if (boolean(value(VERBOSE)))
printf("\ndialing...");
fflush(stdout);
- ioctl(FD, TIOCHPCL, 0);
- ioctl(FD, TIOCFLUSH, 0); /* get rid of garbage */
+ tcgetattr(FD, &cntrl);
+ cntrl.c_cflag |= HUPCL;
+ tcsetattr(FD, TCSANOW, &cntrl);
+ tcflush(FD, TCIOFLUSH);
write(FD, "ATv0\r", 5); /* tell modem to use short status codes */
gobble("\r");
gobble("\r");
@@ -117,7 +123,7 @@ hay_dialer(num, acu)
state = FAILED;
return (connected); /* lets get out of here.. */
}
- ioctl(FD, TIOCFLUSH, 0);
+ tcflush(FD, TCIOFLUSH);
#ifdef ACULOG
if (timeout) {
sprintf(line, "%d second dial timeout",
@@ -245,11 +251,11 @@ goodbye()
int len, rlen;
char c;
- ioctl(FD, TIOCFLUSH, &len); /* get rid of trash */
+ tcflush(FD, TCIOFLUSH);
if (hay_sync()) {
sleep(1);
#ifndef DEBUG
- ioctl(FD, TIOCFLUSH, 0);
+ tcflush(FD, TCIOFLUSH);
#endif
write(FD, "ATH0\r", 5); /* insurance */
#ifndef DEBUG
@@ -277,7 +283,7 @@ goodbye()
printf("read (%d): %s\r\n", rlen, dumbuf);
#endif
}
- ioctl(FD, TIOCFLUSH, 0); /* clear the input buffer */
+ tcflush(FD, TCIOFLUSH);
ioctl(FD, TIOCCDTR, 0); /* clear DTR (insurance) */
close(FD);
}
diff --git a/usr.bin/tip/aculib/t3000.c b/usr.bin/tip/aculib/t3000.c
index e6e1813a879..94bbf9a6f0a 100644
--- a/usr.bin/tip/aculib/t3000.c
+++ b/usr.bin/tip/aculib/t3000.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t3000.c,v 1.2 1994/12/08 09:31:45 jtc Exp $ */
+/* $NetBSD: t3000.c,v 1.3 1995/10/29 00:49:57 pk Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)t3000.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$NetBSD: t3000.c,v 1.2 1994/12/08 09:31:45 jtc Exp $";
+static char rcsid[] = "$NetBSD: t3000.c,v 1.3 1995/10/29 00:49:57 pk Exp $";
#endif /* not lint */
/*
@@ -45,6 +45,8 @@ static char rcsid[] = "$NetBSD: t3000.c,v 1.2 1994/12/08 09:31:45 jtc Exp $";
* Derived from Courier driver.
*/
#include "tip.h"
+
+#include <sys/ioctl.h>
#include <stdio.h>
#define MAXRETRY 5
@@ -60,6 +62,7 @@ t3000_dialer(num, acu)
char *acu;
{
register char *cp;
+ struct termios cntrl;
#ifdef ACULOG
char line[80];
#endif
@@ -68,7 +71,9 @@ t3000_dialer(num, acu)
if (boolean(value(VERBOSE)))
printf("Using \"%s\"\n", acu);
- ioctl(FD, TIOCHPCL, 0);
+ tcgetattr(FD, &cntrl);
+ cntrl.c_cflag |= HUPCL;
+ tcsetattr(FD, TCSANOW, &cntrl);
/*
* Get in synch.
*/
@@ -86,7 +91,7 @@ badsynch:
if (boolean(value(VERBOSE)))
t3000_verbose_read();
#endif
- ioctl(FD, TIOCFLUSH, 0); /* flush any clutter */
+ tcflush(FD, TCIOFLUSH);
t3000_write(FD, "AT E0 H0 Q0 X4 V1\r", 18);
if (!t3000_swallow("\r\nOK\r\n"))
goto badsynch;
@@ -200,7 +205,6 @@ t3000_connect()
{
char c;
int nc, nl, n;
- struct sgttyb sb;
char dialer_buf[64];
struct tbaud_msg *bm;
sig_t f;
@@ -239,25 +243,12 @@ again:
for (bm = tbaud_msg ; bm->msg ; bm++)
if (strcmp(bm->msg,
dialer_buf+sizeof("CONNECT")-1) == 0) {
- if (ioctl(FD, TIOCGETP, &sb) < 0) {
- perror("TIOCGETP");
- goto error;
- }
- sb.sg_ispeed = sb.sg_ospeed = bm->baud;
- if (ioctl(FD, TIOCSETP, &sb) < 0) {
- if (bm->baud2) {
- sb.sg_ispeed =
- sb.sg_ospeed =
- bm->baud2;
- if (ioctl(FD,
- TIOCSETP,
- &sb) >= 0)
- goto isok;
- }
- perror("TIOCSETP");
- goto error;
- }
-isok:
+ struct termios cntrl;
+
+ tcgetattr(FD, &cntrl);
+ cfsetospeed(&cntrl, bm->baud);
+ cfsetispeed(&cntrl, bm->baud);
+ tcsetattr(FD, TCSAFLUSH, &cntrl);
signal(SIGALRM, f);
#ifdef DEBUG
if (boolean(value(VERBOSE)))
@@ -292,7 +283,7 @@ t3000_sync()
char buf[40];
while (already++ < MAXRETRY) {
- ioctl(FD, TIOCFLUSH, 0); /* flush any clutter */
+ tcflush(FD, TCIOFLUSH);
t3000_write(FD, "\rAT Z\r", 6); /* reset modem */
bzero(buf, sizeof(buf));
sleep(2);
@@ -334,19 +325,15 @@ int fd;
char *cp;
int n;
{
- struct sgttyb sb;
-
#ifdef notdef
if (boolean(value(VERBOSE)))
write(1, cp, n);
#endif
- ioctl(fd, TIOCGETP, &sb);
- ioctl(fd, TIOCSETP, &sb);
+ tcdrain(fd);
t3000_nap();
for ( ; n-- ; cp++) {
write(fd, cp, 1);
- ioctl(fd, TIOCGETP, &sb);
- ioctl(fd, TIOCSETP, &sb);
+ tcdrain(fd);
t3000_nap();
}
}
diff --git a/usr.bin/tip/aculib/v3451.c b/usr.bin/tip/aculib/v3451.c
index cd4077277c1..da7f23c405e 100644
--- a/usr.bin/tip/aculib/v3451.c
+++ b/usr.bin/tip/aculib/v3451.c
@@ -1,4 +1,4 @@
-/* $NetBSD: v3451.c,v 1.3 1994/12/08 09:31:48 jtc Exp $ */
+/* $NetBSD: v3451.c,v 1.4 1995/10/29 00:49:59 pk Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)v3451.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$NetBSD: v3451.c,v 1.3 1994/12/08 09:31:48 jtc Exp $";
+static char rcsid[] = "$NetBSD: v3451.c,v 1.4 1995/10/29 00:49:59 pk Exp $";
#endif /* not lint */
/*
@@ -55,6 +55,7 @@ v3451_dialer(num, acu)
int ok;
int slow = number(value(BAUDRATE)) < 1200, rw = 2;
char phone[50];
+ struct termios cntrl;
#ifdef ACULOG
char line[80];
#endif
@@ -75,7 +76,9 @@ v3451_dialer(num, acu)
#endif
return (0);
}
- ioctl(FD, TIOCHPCL, 0);
+ tcgetattr(FD, &cntrl);
+ term.c_cflag |= HUPCL;
+ tcsetattr(FD, TCSANOW, &cntrl);
sleep(1);
vawrite("D\r", 2 + slow);
if (!expect("NUMBER?")) {
@@ -121,7 +124,7 @@ v3451_dialer(num, acu)
#endif
return (0);
}
- ioctl(FD, TIOCFLUSH, &rw);
+ tcflush(FD, TCIOFLUSH);
return (1);
}
diff --git a/usr.bin/tip/aculib/v831.c b/usr.bin/tip/aculib/v831.c
index 5a7d92fea45..42994e540a8 100644
--- a/usr.bin/tip/aculib/v831.c
+++ b/usr.bin/tip/aculib/v831.c
@@ -1,4 +1,4 @@
-/* $NetBSD: v831.c,v 1.3 1994/12/08 09:31:50 jtc Exp $ */
+/* $NetBSD: v831.c,v 1.4 1995/10/29 00:50:02 pk Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -37,13 +37,14 @@
#if 0
static char sccsid[] = "@(#)v831.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$NetBSD: v831.c,v 1.3 1994/12/08 09:31:50 jtc Exp $";
+static char rcsid[] = "$NetBSD: v831.c,v 1.4 1995/10/29 00:50:02 pk Exp $";
#endif /* not lint */
/*
* Routines for dialing up on Vadic 831
*/
#include "tip.h"
+#include <termios.h>
int v831_abort();
static void alarmtr();
@@ -106,9 +107,6 @@ v831_dialer(num, acu)
return (0);
}
alarm(0);
-#ifdef notdef
- ioctl(AC, TIOCHPCL, 0);
-#endif
signal(SIGALRM, SIG_DFL);
while ((pid = wait(&status)) != child && pid != -1)
;
@@ -132,7 +130,7 @@ alarmtr()
*/
v831_disconnect()
{
- struct sgttyb cntrl;
+ struct termios cntrl;
sleep(2);
#ifdef DEBUG
@@ -140,10 +138,11 @@ v831_disconnect()
#endif
if (FD > 0) {
ioctl(FD, TIOCCDTR, 0);
- ioctl(FD, TIOCGETP, &cntrl);
- cntrl.sg_ispeed = cntrl.sg_ospeed = 0;
- ioctl(FD, TIOCSETP, &cntrl);
- ioctl(FD, TIOCNXCL, (struct sgttyb *)NULL);
+ tcgetattr(FD, &cntrl);
+ cfsetospeed(&cntrl, 0);
+ cfsetispeed(&cntrl, 0);
+ tcsetattr(FD, TCSAFLUSH, &cntrl);
+ ioctl(FD, TIOCNXCL, NULL);
}
close(FD);
}
@@ -158,7 +157,7 @@ v831_abort()
if (child > 0)
kill(child, SIGKILL);
if (AC > 0)
- ioctl(FD, TIOCNXCL, (struct sgttyb *)NULL);
+ ioctl(FD, TIOCNXCL, NULL);
close(AC);
if (FD > 0)
ioctl(FD, TIOCCDTR, 0);
@@ -190,7 +189,7 @@ dialit(phonenum, acu)
char *acu;
{
register struct vaconfig *vp;
- struct sgttyb cntrl;
+ struct termios cntrl;
char c;
int i, two = 2;
static char *sanitize();
@@ -208,11 +207,13 @@ dialit(phonenum, acu)
printf("Unable to locate dialer (%s)\n", acu);
return ('K');
}
- ioctl(AC, TIOCGETP, &cntrl);
- cntrl.sg_ispeed = cntrl.sg_ospeed = B2400;
- cntrl.sg_flags = RAW | EVENP | ODDP;
- ioctl(AC, TIOCSETP, &cntrl);
- ioctl(AC, TIOCFLUSH, &two);
+ tcgetattr(AC, &cntrl);
+ cfsetospeed(&cntrl, B2400);
+ cfsetispeed(&cntrl, B2400);
+ cntrl.c_cflag |= PARODD | PARENB;
+ cntrl.c_lflag &= ~(ISIG | ICANON);
+ tcsetattr(AC, TCSANOW, &cntrl);
+ tcflush(AC, TCIOFLUSH);
pc(STX);
pc(vp->vc_rack);
pc(vp->vc_modem);
diff --git a/usr.bin/tip/aculib/ventel.c b/usr.bin/tip/aculib/ventel.c
index 9ebb4188ce1..0ce43ed7aad 100644
--- a/usr.bin/tip/aculib/ventel.c
+++ b/usr.bin/tip/aculib/ventel.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ventel.c,v 1.3 1994/12/08 09:31:52 jtc Exp $ */
+/* $NetBSD: ventel.c,v 1.4 1995/10/29 00:50:04 pk Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)ventel.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$NetBSD: ventel.c,v 1.3 1994/12/08 09:31:52 jtc Exp $";
+static char rcsid[] = "$NetBSD: ventel.c,v 1.4 1995/10/29 00:50:04 pk Exp $";
#endif /* not lint */
/*
@@ -45,6 +45,8 @@ static char rcsid[] = "$NetBSD: ventel.c,v 1.3 1994/12/08 09:31:52 jtc Exp $";
* The Ventel is expected to be strapped for local echo (just like uucp)
*/
#include "tip.h"
+#include <termios.h>
+#include <sys/ioctl.h>
#define MAXRETRY 5
@@ -71,6 +73,7 @@ ven_dialer(num, acu)
char *msg, *index(), line[80];
static int gobble(), vensync();
static void echo();
+ struct termios cntrl;
/*
* Get in synch with a couple of carriage returns
@@ -85,7 +88,9 @@ ven_dialer(num, acu)
if (boolean(value(VERBOSE)))
printf("\ndialing...");
fflush(stdout);
- ioctl(FD, TIOCHPCL, 0);
+ tcgetattr(FD, &cntrl);
+ cntrl.c_cflag |= HUPCL;
+ tcsetattr(FD, TCSANOW, &cntrl);
echo("#k$\r$\n$D$I$A$L$:$ ");
for (cp = num; *cp; cp++) {
delay(1, 10);
@@ -96,7 +101,7 @@ ven_dialer(num, acu)
gobble('\n', line);
if (gobble('\n', line))
connected = gobble('!', line);
- ioctl(FD, TIOCFLUSH);
+ tcflush(FD, TCIOFLUSH);
#ifdef ACULOG
if (timeout) {
sprintf(line, "%d second dial timeout",