Convert to termios (from Scott Reynolds; PR#1621).
8-bit patches (from Matthieu Herrb; PR#1384).
This commit is contained in:
parent
c0a156c9fd
commit
258108ce0f
@ -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
|
* Copyright (c) 1983, 1993
|
||||||
@ -37,7 +37,7 @@
|
|||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)biz22.c 8.1 (Berkeley) 6/6/93";
|
static char sccsid[] = "@(#)biz22.c 8.1 (Berkeley) 6/6/93";
|
||||||
#endif
|
#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 */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include "tip.h"
|
#include "tip.h"
|
||||||
@ -127,7 +127,7 @@ biz22_disconnect()
|
|||||||
|
|
||||||
write(FD, DISCONNECT_CMD, 4);
|
write(FD, DISCONNECT_CMD, 4);
|
||||||
sleep(2);
|
sleep(2);
|
||||||
ioctl(FD, TIOCFLUSH, &rw);
|
tcflush(FD, TCIOFLUSH);
|
||||||
}
|
}
|
||||||
|
|
||||||
biz22_abort()
|
biz22_abort()
|
||||||
|
@ -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
|
* Copyright (c) 1983, 1993
|
||||||
@ -37,7 +37,7 @@
|
|||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)biz31.c 8.1 (Berkeley) 6/6/93";
|
static char sccsid[] = "@(#)biz31.c 8.1 (Berkeley) 6/6/93";
|
||||||
#endif
|
#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 */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include "tip.h"
|
#include "tip.h"
|
||||||
@ -123,7 +123,7 @@ biz31_disconnect()
|
|||||||
|
|
||||||
write(FD, DISCONNECT_CMD, 4);
|
write(FD, DISCONNECT_CMD, 4);
|
||||||
sleep(2);
|
sleep(2);
|
||||||
ioctl(FD, TIOCFLUSH);
|
tcflush(FD, TCIOFLUSH);
|
||||||
}
|
}
|
||||||
|
|
||||||
biz31_abort()
|
biz31_abort()
|
||||||
@ -231,7 +231,7 @@ bizsync(fd)
|
|||||||
|
|
||||||
retry:
|
retry:
|
||||||
if (ioctl(fd, IOCTL, (caddr_t)&b) >= 0 && chars(b) > 0)
|
if (ioctl(fd, IOCTL, (caddr_t)&b) >= 0 && chars(b) > 0)
|
||||||
ioctl(fd, TIOCFLUSH);
|
tcflush(FD, TCIOFLUSH);
|
||||||
write(fd, "\rp>\r", 4);
|
write(fd, "\rp>\r", 4);
|
||||||
sleep(1);
|
sleep(1);
|
||||||
if (ioctl(fd, IOCTL, (caddr_t)&b) >= 0) {
|
if (ioctl(fd, IOCTL, (caddr_t)&b) >= 0) {
|
||||||
|
@ -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
|
* Copyright (c) 1986, 1993
|
||||||
@ -37,7 +37,7 @@
|
|||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)courier.c 8.1 (Berkeley) 6/6/93";
|
static char sccsid[] = "@(#)courier.c 8.1 (Berkeley) 6/6/93";
|
||||||
#endif
|
#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 */
|
#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.
|
* Derived from Hayes driver.
|
||||||
*/
|
*/
|
||||||
#include "tip.h"
|
#include "tip.h"
|
||||||
|
#include <sys/ioctl.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#define MAXRETRY 5
|
#define MAXRETRY 5
|
||||||
@ -63,12 +64,15 @@ cour_dialer(num, acu)
|
|||||||
#ifdef ACULOG
|
#ifdef ACULOG
|
||||||
char line[80];
|
char line[80];
|
||||||
#endif
|
#endif
|
||||||
|
struct termios cntrl;
|
||||||
static int cour_connect(), cour_swallow();
|
static int cour_connect(), cour_swallow();
|
||||||
|
|
||||||
if (boolean(value(VERBOSE)))
|
if (boolean(value(VERBOSE)))
|
||||||
printf("Using \"%s\"\n", acu);
|
printf("Using \"%s\"\n", acu);
|
||||||
|
|
||||||
ioctl(FD, TIOCHPCL, 0);
|
tcgetattr(FD, &cntrl);
|
||||||
|
cntrl.c_cflag |= HUPCL;
|
||||||
|
tcsetattr(FD, TCSAFLUSH, &cntrl);
|
||||||
/*
|
/*
|
||||||
* Get in synch.
|
* Get in synch.
|
||||||
*/
|
*/
|
||||||
@ -86,7 +90,7 @@ badsynch:
|
|||||||
if (boolean(value(VERBOSE)))
|
if (boolean(value(VERBOSE)))
|
||||||
cour_verbose_read();
|
cour_verbose_read();
|
||||||
#endif
|
#endif
|
||||||
ioctl(FD, TIOCFLUSH, 0); /* flush any clutter */
|
tcflush(FD, TCIOFLUSH);
|
||||||
cour_write(FD, "AT C1 E0 H0 Q0 X6 V1\r", 21);
|
cour_write(FD, "AT C1 E0 H0 Q0 X6 V1\r", 21);
|
||||||
if (!cour_swallow("\r\nOK\r\n"))
|
if (!cour_swallow("\r\nOK\r\n"))
|
||||||
goto badsynch;
|
goto badsynch;
|
||||||
@ -186,7 +190,6 @@ cour_connect()
|
|||||||
{
|
{
|
||||||
char c;
|
char c;
|
||||||
int nc, nl, n;
|
int nc, nl, n;
|
||||||
struct sgttyb sb;
|
|
||||||
char dialer_buf[64];
|
char dialer_buf[64];
|
||||||
struct baud_msg *bm;
|
struct baud_msg *bm;
|
||||||
sig_t f;
|
sig_t f;
|
||||||
@ -225,15 +228,12 @@ again:
|
|||||||
for (bm = baud_msg ; bm->msg ; bm++)
|
for (bm = baud_msg ; bm->msg ; bm++)
|
||||||
if (strcmp(bm->msg,
|
if (strcmp(bm->msg,
|
||||||
dialer_buf+sizeof("CONNECT")-1) == 0) {
|
dialer_buf+sizeof("CONNECT")-1) == 0) {
|
||||||
if (ioctl(FD, TIOCGETP, &sb) < 0) {
|
struct termios cntrl;
|
||||||
perror("TIOCGETP");
|
|
||||||
goto error;
|
tcgetattr(FD, &cntrl);
|
||||||
}
|
cfsetospeed(&cntrl, bm->baud);
|
||||||
sb.sg_ispeed = sb.sg_ospeed = bm->baud;
|
cfsetispeed(&cntrl, bm->baud);
|
||||||
if (ioctl(FD, TIOCSETP, &sb) < 0) {
|
tcsetattr(FD, TCSAFLUSH, &cntrl);
|
||||||
perror("TIOCSETP");
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
signal(SIGALRM, f);
|
signal(SIGALRM, f);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (boolean(value(VERBOSE)))
|
if (boolean(value(VERBOSE)))
|
||||||
@ -268,7 +268,7 @@ coursync()
|
|||||||
char buf[40];
|
char buf[40];
|
||||||
|
|
||||||
while (already++ < MAXRETRY) {
|
while (already++ < MAXRETRY) {
|
||||||
ioctl(FD, TIOCFLUSH, 0); /* flush any clutter */
|
tcflush(FD, TCIOFLUSH);
|
||||||
cour_write(FD, "\rAT Z\r", 6); /* reset modem */
|
cour_write(FD, "\rAT Z\r", 6); /* reset modem */
|
||||||
bzero(buf, sizeof(buf));
|
bzero(buf, sizeof(buf));
|
||||||
sleep(1);
|
sleep(1);
|
||||||
@ -307,18 +307,15 @@ int fd;
|
|||||||
char *cp;
|
char *cp;
|
||||||
int n;
|
int n;
|
||||||
{
|
{
|
||||||
struct sgttyb sb;
|
|
||||||
#ifdef notdef
|
#ifdef notdef
|
||||||
if (boolean(value(VERBOSE)))
|
if (boolean(value(VERBOSE)))
|
||||||
write(1, cp, n);
|
write(1, cp, n);
|
||||||
#endif
|
#endif
|
||||||
ioctl(fd, TIOCGETP, &sb);
|
tcdrain(fd);
|
||||||
ioctl(fd, TIOCSETP, &sb);
|
|
||||||
cour_nap();
|
cour_nap();
|
||||||
for ( ; n-- ; cp++) {
|
for ( ; n-- ; cp++) {
|
||||||
write(fd, cp, 1);
|
write(fd, cp, 1);
|
||||||
ioctl(fd, TIOCGETP, &sb);
|
tcdrain(fd);
|
||||||
ioctl(fd, TIOCSETP, &sb);
|
|
||||||
cour_nap();
|
cour_nap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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
|
* Copyright (c) 1983, 1993
|
||||||
@ -37,7 +37,7 @@
|
|||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)df.c 8.1 (Berkeley) 6/6/93";
|
static char sccsid[] = "@(#)df.c 8.1 (Berkeley) 6/6/93";
|
||||||
#endif
|
#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 */
|
#endif /* not lint */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -68,11 +68,13 @@ df_dialer(num, acu, df03)
|
|||||||
int df03;
|
int df03;
|
||||||
{
|
{
|
||||||
register int f = FD;
|
register int f = FD;
|
||||||
struct sgttyb buf;
|
struct termios cntrl;
|
||||||
int speed = 0, rw = 2;
|
int speed = 0, rw = 2;
|
||||||
char c = '\0';
|
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)) {
|
if (setjmp(Sjbuf)) {
|
||||||
printf("connection timed out\r\n");
|
printf("connection timed out\r\n");
|
||||||
df_disconnect();
|
df_disconnect();
|
||||||
@ -85,11 +87,12 @@ df_dialer(num, acu, df03)
|
|||||||
if (df03) {
|
if (df03) {
|
||||||
int st = TIOCM_ST; /* secondary Transmit flag */
|
int st = TIOCM_ST; /* secondary Transmit flag */
|
||||||
|
|
||||||
ioctl(f, TIOCGETP, &buf);
|
tcgetattr(f, &cntrl);
|
||||||
if (buf.sg_ospeed != B1200) { /* must dial at 1200 baud */
|
speed = cfgetospeed(&cntrl);
|
||||||
speed = buf.sg_ospeed;
|
if (speed != B1200) { /* must dial at 1200 baud */
|
||||||
buf.sg_ospeed = buf.sg_ispeed = B1200;
|
cfsetospeed(&cntrl, B1200);
|
||||||
ioctl(f, TIOCSETP, &buf);
|
cfsetispeed(&cntrl, B1200);
|
||||||
|
tcsetattr(f, TCSAFLUSH, &cntrl);
|
||||||
ioctl(f, TIOCMBIC, &st); /* clear ST for 300 baud */
|
ioctl(f, TIOCMBIC, &st); /* clear ST for 300 baud */
|
||||||
} else
|
} else
|
||||||
ioctl(f, TIOCMBIS, &st); /* set ST for 1200 baud */
|
ioctl(f, TIOCMBIS, &st); /* set ST for 1200 baud */
|
||||||
@ -97,16 +100,17 @@ df_dialer(num, acu, df03)
|
|||||||
#endif
|
#endif
|
||||||
signal(SIGALRM, timeout);
|
signal(SIGALRM, timeout);
|
||||||
alarm(5 * strlen(num) + 10);
|
alarm(5 * strlen(num) + 10);
|
||||||
ioctl(f, TIOCFLUSH, &rw);
|
tcflush(f, TCIOFLUSH);
|
||||||
write(f, "\001", 1);
|
write(f, "\001", 1);
|
||||||
sleep(1);
|
sleep(1);
|
||||||
write(f, "\002", 1);
|
write(f, "\002", 1);
|
||||||
write(f, num, strlen(num));
|
write(f, num, strlen(num));
|
||||||
read(f, &c, 1);
|
read(f, &c, 1);
|
||||||
#ifdef TIOCMSET
|
#ifdef TIOCMSET
|
||||||
if (df03 && speed) {
|
if (df03 && speed != B1200) {
|
||||||
buf.sg_ispeed = buf.sg_ospeed = speed;
|
cfsetospeed(&cntrl, speed);
|
||||||
ioctl(f, TIOCSETP, &buf);
|
cfsetispeed(&cntrl, speed);
|
||||||
|
tcsetattr(f, TCSAFLUSH, &cntrl);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return (c == 'A');
|
return (c == 'A');
|
||||||
@ -118,7 +122,7 @@ df_disconnect()
|
|||||||
|
|
||||||
write(FD, "\001", 1);
|
write(FD, "\001", 1);
|
||||||
sleep(1);
|
sleep(1);
|
||||||
ioctl(FD, TIOCFLUSH, &rw);
|
tcflush(FD, TCIOFLUSH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -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
|
* Copyright (c) 1983, 1993
|
||||||
@ -37,7 +37,7 @@
|
|||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)dn11.c 8.1 (Berkeley) 6/6/93";
|
static char sccsid[] = "@(#)dn11.c 8.1 (Berkeley) 6/6/93";
|
||||||
#endif
|
#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 */
|
#endif /* not lint */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -57,6 +57,7 @@ dn_dialer(num, acu)
|
|||||||
char *p, *q, phone[40];
|
char *p, *q, phone[40];
|
||||||
int lt, nw, connected = 1;
|
int lt, nw, connected = 1;
|
||||||
register int timelim;
|
register int timelim;
|
||||||
|
struct termios cntrl;
|
||||||
|
|
||||||
if (boolean(value(VERBOSE)))
|
if (boolean(value(VERBOSE)))
|
||||||
printf("\nstarting call...");
|
printf("\nstarting call...");
|
||||||
@ -100,7 +101,9 @@ dn_dialer(num, acu)
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
alarm(0);
|
alarm(0);
|
||||||
ioctl(dn, TIOCHPCL, 0);
|
tcgetattr(dn, &cntrl);
|
||||||
|
cntrl.c_cflag |= HUPCL;
|
||||||
|
tcsetattr(dn, TCSANOW, &cntrl);
|
||||||
signal(SIGALRM, SIG_DFL);
|
signal(SIGALRM, SIG_DFL);
|
||||||
while ((nw = wait(<)) != child && nw != -1)
|
while ((nw = wait(<)) != child && nw != -1)
|
||||||
;
|
;
|
||||||
|
@ -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
|
* Copyright (c) 1983, 1993
|
||||||
@ -37,7 +37,7 @@
|
|||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)hayes.c 8.1 (Berkeley) 6/6/93";
|
static char sccsid[] = "@(#)hayes.c 8.1 (Berkeley) 6/6/93";
|
||||||
#endif
|
#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 */
|
#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 "tip.h"
|
||||||
|
|
||||||
|
#include <termios.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
|
||||||
#define min(a,b) ((a < b) ? a : b)
|
#define min(a,b) ((a < b) ? a : b)
|
||||||
|
|
||||||
static void sigALRM();
|
static void sigALRM();
|
||||||
@ -87,6 +90,7 @@ hay_dialer(num, acu)
|
|||||||
register char *cp;
|
register char *cp;
|
||||||
register int connected = 0;
|
register int connected = 0;
|
||||||
char dummy;
|
char dummy;
|
||||||
|
struct termios cntrl;
|
||||||
#ifdef ACULOG
|
#ifdef ACULOG
|
||||||
char line[80];
|
char line[80];
|
||||||
#endif
|
#endif
|
||||||
@ -95,8 +99,10 @@ hay_dialer(num, acu)
|
|||||||
if (boolean(value(VERBOSE)))
|
if (boolean(value(VERBOSE)))
|
||||||
printf("\ndialing...");
|
printf("\ndialing...");
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
ioctl(FD, TIOCHPCL, 0);
|
tcgetattr(FD, &cntrl);
|
||||||
ioctl(FD, TIOCFLUSH, 0); /* get rid of garbage */
|
cntrl.c_cflag |= HUPCL;
|
||||||
|
tcsetattr(FD, TCSANOW, &cntrl);
|
||||||
|
tcflush(FD, TCIOFLUSH);
|
||||||
write(FD, "ATv0\r", 5); /* tell modem to use short status codes */
|
write(FD, "ATv0\r", 5); /* tell modem to use short status codes */
|
||||||
gobble("\r");
|
gobble("\r");
|
||||||
gobble("\r");
|
gobble("\r");
|
||||||
@ -117,7 +123,7 @@ hay_dialer(num, acu)
|
|||||||
state = FAILED;
|
state = FAILED;
|
||||||
return (connected); /* lets get out of here.. */
|
return (connected); /* lets get out of here.. */
|
||||||
}
|
}
|
||||||
ioctl(FD, TIOCFLUSH, 0);
|
tcflush(FD, TCIOFLUSH);
|
||||||
#ifdef ACULOG
|
#ifdef ACULOG
|
||||||
if (timeout) {
|
if (timeout) {
|
||||||
sprintf(line, "%d second dial timeout",
|
sprintf(line, "%d second dial timeout",
|
||||||
@ -245,11 +251,11 @@ goodbye()
|
|||||||
int len, rlen;
|
int len, rlen;
|
||||||
char c;
|
char c;
|
||||||
|
|
||||||
ioctl(FD, TIOCFLUSH, &len); /* get rid of trash */
|
tcflush(FD, TCIOFLUSH);
|
||||||
if (hay_sync()) {
|
if (hay_sync()) {
|
||||||
sleep(1);
|
sleep(1);
|
||||||
#ifndef DEBUG
|
#ifndef DEBUG
|
||||||
ioctl(FD, TIOCFLUSH, 0);
|
tcflush(FD, TCIOFLUSH);
|
||||||
#endif
|
#endif
|
||||||
write(FD, "ATH0\r", 5); /* insurance */
|
write(FD, "ATH0\r", 5); /* insurance */
|
||||||
#ifndef DEBUG
|
#ifndef DEBUG
|
||||||
@ -277,7 +283,7 @@ goodbye()
|
|||||||
printf("read (%d): %s\r\n", rlen, dumbuf);
|
printf("read (%d): %s\r\n", rlen, dumbuf);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
ioctl(FD, TIOCFLUSH, 0); /* clear the input buffer */
|
tcflush(FD, TCIOFLUSH);
|
||||||
ioctl(FD, TIOCCDTR, 0); /* clear DTR (insurance) */
|
ioctl(FD, TIOCCDTR, 0); /* clear DTR (insurance) */
|
||||||
close(FD);
|
close(FD);
|
||||||
}
|
}
|
||||||
|
@ -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
|
* Copyright (c) 1992, 1993
|
||||||
@ -37,7 +37,7 @@
|
|||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)t3000.c 8.1 (Berkeley) 6/6/93";
|
static char sccsid[] = "@(#)t3000.c 8.1 (Berkeley) 6/6/93";
|
||||||
#endif
|
#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 */
|
#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.
|
* Derived from Courier driver.
|
||||||
*/
|
*/
|
||||||
#include "tip.h"
|
#include "tip.h"
|
||||||
|
|
||||||
|
#include <sys/ioctl.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#define MAXRETRY 5
|
#define MAXRETRY 5
|
||||||
@ -60,6 +62,7 @@ t3000_dialer(num, acu)
|
|||||||
char *acu;
|
char *acu;
|
||||||
{
|
{
|
||||||
register char *cp;
|
register char *cp;
|
||||||
|
struct termios cntrl;
|
||||||
#ifdef ACULOG
|
#ifdef ACULOG
|
||||||
char line[80];
|
char line[80];
|
||||||
#endif
|
#endif
|
||||||
@ -68,7 +71,9 @@ t3000_dialer(num, acu)
|
|||||||
if (boolean(value(VERBOSE)))
|
if (boolean(value(VERBOSE)))
|
||||||
printf("Using \"%s\"\n", acu);
|
printf("Using \"%s\"\n", acu);
|
||||||
|
|
||||||
ioctl(FD, TIOCHPCL, 0);
|
tcgetattr(FD, &cntrl);
|
||||||
|
cntrl.c_cflag |= HUPCL;
|
||||||
|
tcsetattr(FD, TCSANOW, &cntrl);
|
||||||
/*
|
/*
|
||||||
* Get in synch.
|
* Get in synch.
|
||||||
*/
|
*/
|
||||||
@ -86,7 +91,7 @@ badsynch:
|
|||||||
if (boolean(value(VERBOSE)))
|
if (boolean(value(VERBOSE)))
|
||||||
t3000_verbose_read();
|
t3000_verbose_read();
|
||||||
#endif
|
#endif
|
||||||
ioctl(FD, TIOCFLUSH, 0); /* flush any clutter */
|
tcflush(FD, TCIOFLUSH);
|
||||||
t3000_write(FD, "AT E0 H0 Q0 X4 V1\r", 18);
|
t3000_write(FD, "AT E0 H0 Q0 X4 V1\r", 18);
|
||||||
if (!t3000_swallow("\r\nOK\r\n"))
|
if (!t3000_swallow("\r\nOK\r\n"))
|
||||||
goto badsynch;
|
goto badsynch;
|
||||||
@ -200,7 +205,6 @@ t3000_connect()
|
|||||||
{
|
{
|
||||||
char c;
|
char c;
|
||||||
int nc, nl, n;
|
int nc, nl, n;
|
||||||
struct sgttyb sb;
|
|
||||||
char dialer_buf[64];
|
char dialer_buf[64];
|
||||||
struct tbaud_msg *bm;
|
struct tbaud_msg *bm;
|
||||||
sig_t f;
|
sig_t f;
|
||||||
@ -239,25 +243,12 @@ again:
|
|||||||
for (bm = tbaud_msg ; bm->msg ; bm++)
|
for (bm = tbaud_msg ; bm->msg ; bm++)
|
||||||
if (strcmp(bm->msg,
|
if (strcmp(bm->msg,
|
||||||
dialer_buf+sizeof("CONNECT")-1) == 0) {
|
dialer_buf+sizeof("CONNECT")-1) == 0) {
|
||||||
if (ioctl(FD, TIOCGETP, &sb) < 0) {
|
struct termios cntrl;
|
||||||
perror("TIOCGETP");
|
|
||||||
goto error;
|
tcgetattr(FD, &cntrl);
|
||||||
}
|
cfsetospeed(&cntrl, bm->baud);
|
||||||
sb.sg_ispeed = sb.sg_ospeed = bm->baud;
|
cfsetispeed(&cntrl, bm->baud);
|
||||||
if (ioctl(FD, TIOCSETP, &sb) < 0) {
|
tcsetattr(FD, TCSAFLUSH, &cntrl);
|
||||||
if (bm->baud2) {
|
|
||||||
sb.sg_ispeed =
|
|
||||||
sb.sg_ospeed =
|
|
||||||
bm->baud2;
|
|
||||||
if (ioctl(FD,
|
|
||||||
TIOCSETP,
|
|
||||||
&sb) >= 0)
|
|
||||||
goto isok;
|
|
||||||
}
|
|
||||||
perror("TIOCSETP");
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
isok:
|
|
||||||
signal(SIGALRM, f);
|
signal(SIGALRM, f);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (boolean(value(VERBOSE)))
|
if (boolean(value(VERBOSE)))
|
||||||
@ -292,7 +283,7 @@ t3000_sync()
|
|||||||
char buf[40];
|
char buf[40];
|
||||||
|
|
||||||
while (already++ < MAXRETRY) {
|
while (already++ < MAXRETRY) {
|
||||||
ioctl(FD, TIOCFLUSH, 0); /* flush any clutter */
|
tcflush(FD, TCIOFLUSH);
|
||||||
t3000_write(FD, "\rAT Z\r", 6); /* reset modem */
|
t3000_write(FD, "\rAT Z\r", 6); /* reset modem */
|
||||||
bzero(buf, sizeof(buf));
|
bzero(buf, sizeof(buf));
|
||||||
sleep(2);
|
sleep(2);
|
||||||
@ -334,19 +325,15 @@ int fd;
|
|||||||
char *cp;
|
char *cp;
|
||||||
int n;
|
int n;
|
||||||
{
|
{
|
||||||
struct sgttyb sb;
|
|
||||||
|
|
||||||
#ifdef notdef
|
#ifdef notdef
|
||||||
if (boolean(value(VERBOSE)))
|
if (boolean(value(VERBOSE)))
|
||||||
write(1, cp, n);
|
write(1, cp, n);
|
||||||
#endif
|
#endif
|
||||||
ioctl(fd, TIOCGETP, &sb);
|
tcdrain(fd);
|
||||||
ioctl(fd, TIOCSETP, &sb);
|
|
||||||
t3000_nap();
|
t3000_nap();
|
||||||
for ( ; n-- ; cp++) {
|
for ( ; n-- ; cp++) {
|
||||||
write(fd, cp, 1);
|
write(fd, cp, 1);
|
||||||
ioctl(fd, TIOCGETP, &sb);
|
tcdrain(fd);
|
||||||
ioctl(fd, TIOCSETP, &sb);
|
|
||||||
t3000_nap();
|
t3000_nap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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
|
* Copyright (c) 1983, 1993
|
||||||
@ -37,7 +37,7 @@
|
|||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)v3451.c 8.1 (Berkeley) 6/6/93";
|
static char sccsid[] = "@(#)v3451.c 8.1 (Berkeley) 6/6/93";
|
||||||
#endif
|
#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 */
|
#endif /* not lint */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -55,6 +55,7 @@ v3451_dialer(num, acu)
|
|||||||
int ok;
|
int ok;
|
||||||
int slow = number(value(BAUDRATE)) < 1200, rw = 2;
|
int slow = number(value(BAUDRATE)) < 1200, rw = 2;
|
||||||
char phone[50];
|
char phone[50];
|
||||||
|
struct termios cntrl;
|
||||||
#ifdef ACULOG
|
#ifdef ACULOG
|
||||||
char line[80];
|
char line[80];
|
||||||
#endif
|
#endif
|
||||||
@ -75,7 +76,9 @@ v3451_dialer(num, acu)
|
|||||||
#endif
|
#endif
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
ioctl(FD, TIOCHPCL, 0);
|
tcgetattr(FD, &cntrl);
|
||||||
|
term.c_cflag |= HUPCL;
|
||||||
|
tcsetattr(FD, TCSANOW, &cntrl);
|
||||||
sleep(1);
|
sleep(1);
|
||||||
vawrite("D\r", 2 + slow);
|
vawrite("D\r", 2 + slow);
|
||||||
if (!expect("NUMBER?")) {
|
if (!expect("NUMBER?")) {
|
||||||
@ -121,7 +124,7 @@ v3451_dialer(num, acu)
|
|||||||
#endif
|
#endif
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
ioctl(FD, TIOCFLUSH, &rw);
|
tcflush(FD, TCIOFLUSH);
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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
|
* Copyright (c) 1983, 1993
|
||||||
@ -37,13 +37,14 @@
|
|||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)v831.c 8.1 (Berkeley) 6/6/93";
|
static char sccsid[] = "@(#)v831.c 8.1 (Berkeley) 6/6/93";
|
||||||
#endif
|
#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 */
|
#endif /* not lint */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Routines for dialing up on Vadic 831
|
* Routines for dialing up on Vadic 831
|
||||||
*/
|
*/
|
||||||
#include "tip.h"
|
#include "tip.h"
|
||||||
|
#include <termios.h>
|
||||||
|
|
||||||
int v831_abort();
|
int v831_abort();
|
||||||
static void alarmtr();
|
static void alarmtr();
|
||||||
@ -106,9 +107,6 @@ v831_dialer(num, acu)
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
alarm(0);
|
alarm(0);
|
||||||
#ifdef notdef
|
|
||||||
ioctl(AC, TIOCHPCL, 0);
|
|
||||||
#endif
|
|
||||||
signal(SIGALRM, SIG_DFL);
|
signal(SIGALRM, SIG_DFL);
|
||||||
while ((pid = wait(&status)) != child && pid != -1)
|
while ((pid = wait(&status)) != child && pid != -1)
|
||||||
;
|
;
|
||||||
@ -132,7 +130,7 @@ alarmtr()
|
|||||||
*/
|
*/
|
||||||
v831_disconnect()
|
v831_disconnect()
|
||||||
{
|
{
|
||||||
struct sgttyb cntrl;
|
struct termios cntrl;
|
||||||
|
|
||||||
sleep(2);
|
sleep(2);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -140,10 +138,11 @@ v831_disconnect()
|
|||||||
#endif
|
#endif
|
||||||
if (FD > 0) {
|
if (FD > 0) {
|
||||||
ioctl(FD, TIOCCDTR, 0);
|
ioctl(FD, TIOCCDTR, 0);
|
||||||
ioctl(FD, TIOCGETP, &cntrl);
|
tcgetattr(FD, &cntrl);
|
||||||
cntrl.sg_ispeed = cntrl.sg_ospeed = 0;
|
cfsetospeed(&cntrl, 0);
|
||||||
ioctl(FD, TIOCSETP, &cntrl);
|
cfsetispeed(&cntrl, 0);
|
||||||
ioctl(FD, TIOCNXCL, (struct sgttyb *)NULL);
|
tcsetattr(FD, TCSAFLUSH, &cntrl);
|
||||||
|
ioctl(FD, TIOCNXCL, NULL);
|
||||||
}
|
}
|
||||||
close(FD);
|
close(FD);
|
||||||
}
|
}
|
||||||
@ -158,7 +157,7 @@ v831_abort()
|
|||||||
if (child > 0)
|
if (child > 0)
|
||||||
kill(child, SIGKILL);
|
kill(child, SIGKILL);
|
||||||
if (AC > 0)
|
if (AC > 0)
|
||||||
ioctl(FD, TIOCNXCL, (struct sgttyb *)NULL);
|
ioctl(FD, TIOCNXCL, NULL);
|
||||||
close(AC);
|
close(AC);
|
||||||
if (FD > 0)
|
if (FD > 0)
|
||||||
ioctl(FD, TIOCCDTR, 0);
|
ioctl(FD, TIOCCDTR, 0);
|
||||||
@ -190,7 +189,7 @@ dialit(phonenum, acu)
|
|||||||
char *acu;
|
char *acu;
|
||||||
{
|
{
|
||||||
register struct vaconfig *vp;
|
register struct vaconfig *vp;
|
||||||
struct sgttyb cntrl;
|
struct termios cntrl;
|
||||||
char c;
|
char c;
|
||||||
int i, two = 2;
|
int i, two = 2;
|
||||||
static char *sanitize();
|
static char *sanitize();
|
||||||
@ -208,11 +207,13 @@ dialit(phonenum, acu)
|
|||||||
printf("Unable to locate dialer (%s)\n", acu);
|
printf("Unable to locate dialer (%s)\n", acu);
|
||||||
return ('K');
|
return ('K');
|
||||||
}
|
}
|
||||||
ioctl(AC, TIOCGETP, &cntrl);
|
tcgetattr(AC, &cntrl);
|
||||||
cntrl.sg_ispeed = cntrl.sg_ospeed = B2400;
|
cfsetospeed(&cntrl, B2400);
|
||||||
cntrl.sg_flags = RAW | EVENP | ODDP;
|
cfsetispeed(&cntrl, B2400);
|
||||||
ioctl(AC, TIOCSETP, &cntrl);
|
cntrl.c_cflag |= PARODD | PARENB;
|
||||||
ioctl(AC, TIOCFLUSH, &two);
|
cntrl.c_lflag &= ~(ISIG | ICANON);
|
||||||
|
tcsetattr(AC, TCSANOW, &cntrl);
|
||||||
|
tcflush(AC, TCIOFLUSH);
|
||||||
pc(STX);
|
pc(STX);
|
||||||
pc(vp->vc_rack);
|
pc(vp->vc_rack);
|
||||||
pc(vp->vc_modem);
|
pc(vp->vc_modem);
|
||||||
|
@ -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
|
* Copyright (c) 1983, 1993
|
||||||
@ -37,7 +37,7 @@
|
|||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)ventel.c 8.1 (Berkeley) 6/6/93";
|
static char sccsid[] = "@(#)ventel.c 8.1 (Berkeley) 6/6/93";
|
||||||
#endif
|
#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 */
|
#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)
|
* The Ventel is expected to be strapped for local echo (just like uucp)
|
||||||
*/
|
*/
|
||||||
#include "tip.h"
|
#include "tip.h"
|
||||||
|
#include <termios.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
|
||||||
#define MAXRETRY 5
|
#define MAXRETRY 5
|
||||||
|
|
||||||
@ -71,6 +73,7 @@ ven_dialer(num, acu)
|
|||||||
char *msg, *index(), line[80];
|
char *msg, *index(), line[80];
|
||||||
static int gobble(), vensync();
|
static int gobble(), vensync();
|
||||||
static void echo();
|
static void echo();
|
||||||
|
struct termios cntrl;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get in synch with a couple of carriage returns
|
* Get in synch with a couple of carriage returns
|
||||||
@ -85,7 +88,9 @@ ven_dialer(num, acu)
|
|||||||
if (boolean(value(VERBOSE)))
|
if (boolean(value(VERBOSE)))
|
||||||
printf("\ndialing...");
|
printf("\ndialing...");
|
||||||
fflush(stdout);
|
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$:$ ");
|
echo("#k$\r$\n$D$I$A$L$:$ ");
|
||||||
for (cp = num; *cp; cp++) {
|
for (cp = num; *cp; cp++) {
|
||||||
delay(1, 10);
|
delay(1, 10);
|
||||||
@ -96,7 +101,7 @@ ven_dialer(num, acu)
|
|||||||
gobble('\n', line);
|
gobble('\n', line);
|
||||||
if (gobble('\n', line))
|
if (gobble('\n', line))
|
||||||
connected = gobble('!', line);
|
connected = gobble('!', line);
|
||||||
ioctl(FD, TIOCFLUSH);
|
tcflush(FD, TCIOFLUSH);
|
||||||
#ifdef ACULOG
|
#ifdef ACULOG
|
||||||
if (timeout) {
|
if (timeout) {
|
||||||
sprintf(line, "%d second dial timeout",
|
sprintf(line, "%d second dial timeout",
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: cmds.c,v 1.5 1995/09/26 06:02:08 jtc Exp $ */
|
/* $NetBSD: cmds.c,v 1.6 1995/10/29 00:49:38 pk Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1983, 1993
|
* Copyright (c) 1983, 1993
|
||||||
@ -37,7 +37,7 @@
|
|||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)cmds.c 8.1 (Berkeley) 6/6/93";
|
static char sccsid[] = "@(#)cmds.c 8.1 (Berkeley) 6/6/93";
|
||||||
#endif
|
#endif
|
||||||
static char rcsid[] = "$NetBSD: cmds.c,v 1.5 1995/09/26 06:02:08 jtc Exp $";
|
static char rcsid[] = "$NetBSD: cmds.c,v 1.6 1995/10/29 00:49:38 pk Exp $";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include "tip.h"
|
#include "tip.h"
|
||||||
@ -144,15 +144,15 @@ transfer(buf, fd, eofchars)
|
|||||||
pwrite(FD, &r, 1);
|
pwrite(FD, &r, 1);
|
||||||
do
|
do
|
||||||
read(FD, &c, 1);
|
read(FD, &c, 1);
|
||||||
while ((c&0177) != '\n');
|
while ((c&STRIP_PAR) != '\n');
|
||||||
ioctl(0, TIOCSETC, &defchars);
|
tcsetattr(0, TCSAFLUSH, &defchars);
|
||||||
|
|
||||||
(void) setjmp(intbuf);
|
(void) setjmp(intbuf);
|
||||||
f = signal(SIGINT, intcopy);
|
f = signal(SIGINT, intcopy);
|
||||||
start = time(0);
|
start = time(0);
|
||||||
for (ct = 0; !quit;) {
|
for (ct = 0; !quit;) {
|
||||||
eof = read(FD, &c, 1) <= 0;
|
eof = read(FD, &c, 1) <= 0;
|
||||||
c &= 0177;
|
c &= STRIP_PAR;
|
||||||
if (quit)
|
if (quit)
|
||||||
continue;
|
continue;
|
||||||
if (eof || any(c, eofchars))
|
if (eof || any(c, eofchars))
|
||||||
@ -179,7 +179,7 @@ transfer(buf, fd, eofchars)
|
|||||||
|
|
||||||
if (boolean(value(VERBOSE)))
|
if (boolean(value(VERBOSE)))
|
||||||
prtime(" lines transferred in ", time(0)-start);
|
prtime(" lines transferred in ", time(0)-start);
|
||||||
ioctl(0, TIOCSETC, &tchars);
|
tcsetattr(0, TCSAFLUSH, &term);
|
||||||
write(fildes[1], (char *)&ccc, 1);
|
write(fildes[1], (char *)&ccc, 1);
|
||||||
signal(SIGINT, f);
|
signal(SIGINT, f);
|
||||||
close(fd);
|
close(fd);
|
||||||
@ -271,12 +271,8 @@ sendfile(cc)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
transmit(fd, value(EOFWRITE), NULL);
|
transmit(fd, value(EOFWRITE), NULL);
|
||||||
if (!boolean(value(ECHOCHECK))) {
|
if (!boolean(value(ECHOCHECK)))
|
||||||
struct sgttyb buf;
|
tcdrain(FD);
|
||||||
|
|
||||||
ioctl(FD, TIOCGETP, &buf); /* this does a */
|
|
||||||
ioctl(FD, TIOCSETP, &buf); /* wflushtty */
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -295,7 +291,7 @@ transmit(fd, eofchars, command)
|
|||||||
kill(pid, SIGIOT); /* put TIPOUT into a wait state */
|
kill(pid, SIGIOT); /* put TIPOUT into a wait state */
|
||||||
stop = 0;
|
stop = 0;
|
||||||
f = signal(SIGINT, stopsnd);
|
f = signal(SIGINT, stopsnd);
|
||||||
ioctl(0, TIOCSETC, &defchars);
|
tcsetattr(0, TCSAFLUSH, &defchars);
|
||||||
read(repdes[0], (char *)&ccc, 1);
|
read(repdes[0], (char *)&ccc, 1);
|
||||||
if (command != NULL) {
|
if (command != NULL) {
|
||||||
for (pc = command; *pc; pc++)
|
for (pc = command; *pc; pc++)
|
||||||
@ -303,10 +299,7 @@ transmit(fd, eofchars, command)
|
|||||||
if (boolean(value(ECHOCHECK)))
|
if (boolean(value(ECHOCHECK)))
|
||||||
read(FD, (char *)&c, 1); /* trailing \n */
|
read(FD, (char *)&c, 1); /* trailing \n */
|
||||||
else {
|
else {
|
||||||
struct sgttyb buf;
|
tcdrain(FD);
|
||||||
|
|
||||||
ioctl(FD, TIOCGETP, &buf); /* this does a */
|
|
||||||
ioctl(FD, TIOCSETP, &buf); /* wflushtty */
|
|
||||||
sleep(5); /* wait for remote stty to take effect */
|
sleep(5); /* wait for remote stty to take effect */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -357,7 +350,7 @@ transmit(fd, eofchars, command)
|
|||||||
alarm(0);
|
alarm(0);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
} while ((c&0177) != character(value(PROMPT)));
|
} while ((c&STRIP_PAR) != character(value(PROMPT)));
|
||||||
alarm(0);
|
alarm(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -377,7 +370,7 @@ out:
|
|||||||
else
|
else
|
||||||
prtime(" lines transferred in ", stop_t-start_t);
|
prtime(" lines transferred in ", stop_t-start_t);
|
||||||
write(fildes[1], (char *)&ccc, 1);
|
write(fildes[1], (char *)&ccc, 1);
|
||||||
ioctl(0, TIOCSETC, &tchars);
|
tcsetattr(0, TCSAFLUSH, &term);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -472,7 +465,7 @@ pipeout(c)
|
|||||||
kill(pid, SIGIOT); /* put TIPOUT into a wait state */
|
kill(pid, SIGIOT); /* put TIPOUT into a wait state */
|
||||||
signal(SIGINT, SIG_IGN);
|
signal(SIGINT, SIG_IGN);
|
||||||
signal(SIGQUIT, SIG_IGN);
|
signal(SIGQUIT, SIG_IGN);
|
||||||
ioctl(0, TIOCSETC, &defchars);
|
tcsetattr(0, TCSAFLUSH, &defchars);
|
||||||
read(repdes[0], (char *)&ccc, 1);
|
read(repdes[0], (char *)&ccc, 1);
|
||||||
/*
|
/*
|
||||||
* Set up file descriptors in the child and
|
* Set up file descriptors in the child and
|
||||||
@ -499,7 +492,7 @@ pipeout(c)
|
|||||||
if (boolean(value(VERBOSE)))
|
if (boolean(value(VERBOSE)))
|
||||||
prtime("away for ", time(0)-start);
|
prtime("away for ", time(0)-start);
|
||||||
write(fildes[1], (char *)&ccc, 1);
|
write(fildes[1], (char *)&ccc, 1);
|
||||||
ioctl(0, TIOCSETC, &tchars);
|
tcsetattr(0, TCSAFLUSH, &term);
|
||||||
signal(SIGINT, SIG_DFL);
|
signal(SIGINT, SIG_DFL);
|
||||||
signal(SIGQUIT, SIG_DFL);
|
signal(SIGQUIT, SIG_DFL);
|
||||||
}
|
}
|
||||||
@ -523,7 +516,7 @@ consh(c)
|
|||||||
kill(pid, SIGIOT); /* put TIPOUT into a wait state */
|
kill(pid, SIGIOT); /* put TIPOUT into a wait state */
|
||||||
signal(SIGINT, SIG_IGN);
|
signal(SIGINT, SIG_IGN);
|
||||||
signal(SIGQUIT, SIG_IGN);
|
signal(SIGQUIT, SIG_IGN);
|
||||||
ioctl(0, TIOCSETC, &defchars);
|
tcsetattr(0, TCSAFLUSH, &defchars);
|
||||||
read(repdes[0], (char *)&ccc, 1);
|
read(repdes[0], (char *)&ccc, 1);
|
||||||
/*
|
/*
|
||||||
* Set up file descriptors in the child and
|
* Set up file descriptors in the child and
|
||||||
@ -551,7 +544,7 @@ consh(c)
|
|||||||
if (boolean(value(VERBOSE)))
|
if (boolean(value(VERBOSE)))
|
||||||
prtime("away for ", time(0)-start);
|
prtime("away for ", time(0)-start);
|
||||||
write(fildes[1], (char *)&ccc, 1);
|
write(fildes[1], (char *)&ccc, 1);
|
||||||
ioctl(0, TIOCSETC, &tchars);
|
tcsetattr(0, TCSAFLUSH, &term);
|
||||||
signal(SIGINT, SIG_DFL);
|
signal(SIGINT, SIG_DFL);
|
||||||
signal(SIGQUIT, SIG_DFL);
|
signal(SIGQUIT, SIG_DFL);
|
||||||
}
|
}
|
||||||
@ -771,18 +764,18 @@ variable()
|
|||||||
tandem(option)
|
tandem(option)
|
||||||
char *option;
|
char *option;
|
||||||
{
|
{
|
||||||
struct sgttyb rmtty;
|
struct termios rmtty;
|
||||||
|
|
||||||
ioctl(FD, TIOCGETP, &rmtty);
|
tcgetattr(FD, &rmtty);
|
||||||
if (strcmp(option,"on") == 0) {
|
if (strcmp(option, "on") == 0) {
|
||||||
rmtty.sg_flags |= TANDEM;
|
rmtty.c_iflag |= IXOFF;
|
||||||
arg.sg_flags |= TANDEM;
|
term.c_iflag |= IXOFF;
|
||||||
} else {
|
} else {
|
||||||
rmtty.sg_flags &= ~TANDEM;
|
rmtty.c_iflag &= ~IXOFF;
|
||||||
arg.sg_flags &= ~TANDEM;
|
term.c_iflag &= ~IXOFF;
|
||||||
}
|
}
|
||||||
ioctl(FD, TIOCSETP, &rmtty);
|
tcsetattr(FD, TCSADRAIN, &rmtty);
|
||||||
ioctl(0, TIOCSETP, &arg);
|
tcsetattr(0, TCSADRAIN, &term);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: hunt.c,v 1.4 1994/12/24 17:56:27 cgd Exp $ */
|
/* $NetBSD: hunt.c,v 1.5 1995/10/29 00:49:40 pk Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1983, 1993
|
* Copyright (c) 1983, 1993
|
||||||
@ -37,7 +37,7 @@
|
|||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)hunt.c 8.1 (Berkeley) 6/6/93";
|
static char sccsid[] = "@(#)hunt.c 8.1 (Berkeley) 6/6/93";
|
||||||
#endif
|
#endif
|
||||||
static char rcsid[] = "$NetBSD: hunt.c,v 1.4 1994/12/24 17:56:27 cgd Exp $";
|
static char rcsid[] = "$NetBSD: hunt.c,v 1.5 1995/10/29 00:49:40 pk Exp $";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include "tip.h"
|
#include "tip.h"
|
||||||
@ -87,8 +87,12 @@ hunt(name)
|
|||||||
deadfl = 1;
|
deadfl = 1;
|
||||||
}
|
}
|
||||||
if (!deadfl) {
|
if (!deadfl) {
|
||||||
|
struct termios cntrl;
|
||||||
|
|
||||||
|
tcgetattr(FD, &cntrl);
|
||||||
|
cntrl.c_cflag |= HUPCL;
|
||||||
|
tcsetattr(FD, TCSAFLUSH, &cntrl);
|
||||||
ioctl(FD, TIOCEXCL, 0);
|
ioctl(FD, TIOCEXCL, 0);
|
||||||
ioctl(FD, TIOCHPCL, 0);
|
|
||||||
signal(SIGALRM, SIG_DFL);
|
signal(SIGALRM, SIG_DFL);
|
||||||
return ((long)cp);
|
return ((long)cp);
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: tip.c,v 1.7 1995/08/11 00:10:40 jtc Exp $ */
|
/* $NetBSD: tip.c,v 1.8 1995/10/29 00:49:42 pk Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1983, 1993
|
* Copyright (c) 1983, 1993
|
||||||
@ -43,7 +43,7 @@ static char copyright[] =
|
|||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)tip.c 8.1 (Berkeley) 6/6/93";
|
static char sccsid[] = "@(#)tip.c 8.1 (Berkeley) 6/6/93";
|
||||||
#endif
|
#endif
|
||||||
static char rcsid[] = "$NetBSD: tip.c,v 1.7 1995/08/11 00:10:40 jtc Exp $";
|
static char rcsid[] = "$NetBSD: tip.c,v 1.8 1995/10/29 00:49:42 pk Exp $";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -58,12 +58,12 @@ static char rcsid[] = "$NetBSD: tip.c,v 1.7 1995/08/11 00:10:40 jtc Exp $";
|
|||||||
/*
|
/*
|
||||||
* Baud rate mapping table
|
* Baud rate mapping table
|
||||||
*/
|
*/
|
||||||
int bauds[] = {
|
int rates[] = {
|
||||||
0, 50, 75, 110, 134, 150, 200, 300, 600,
|
0, 50, 75, 110, 134, 150, 200, 300, 600,
|
||||||
1200, 1800, 2400, 4800, 9600, 19200, 38400, 57600, 115200, -1
|
1200, 1800, 2400, 4800, 9600, 19200, 38400, 57600, 115200, -1
|
||||||
};
|
};
|
||||||
|
|
||||||
int disc = OTTYDISC; /* tip normally runs this way */
|
int disc = TTYDISC; /* tip normally runs this way */
|
||||||
void intprompt();
|
void intprompt();
|
||||||
void timeout();
|
void timeout();
|
||||||
void cleanup();
|
void cleanup();
|
||||||
@ -173,7 +173,7 @@ notnumber:
|
|||||||
PH = _PATH_PHONES;
|
PH = _PATH_PHONES;
|
||||||
vinit(); /* init variables */
|
vinit(); /* init variables */
|
||||||
setparity("even"); /* set the parity table */
|
setparity("even"); /* set the parity table */
|
||||||
if ((i = speed(number(value(BAUDRATE)))) == NULL) {
|
if ((i = speed(number(value(BAUDRATE)))) == 0) {
|
||||||
printf("tip: bad baud rate %d\n", number(value(BAUDRATE)));
|
printf("tip: bad baud rate %d\n", number(value(BAUDRATE)));
|
||||||
daemon_uid();
|
daemon_uid();
|
||||||
(void)uu_unlock(uucplock);
|
(void)uu_unlock(uucplock);
|
||||||
@ -201,17 +201,17 @@ cucommon:
|
|||||||
* the "cu" version of tip.
|
* the "cu" version of tip.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ioctl(0, TIOCGETP, (char *)&defarg);
|
tcgetattr(0, &defterm);
|
||||||
ioctl(0, TIOCGETC, (char *)&defchars);
|
term = defterm;
|
||||||
ioctl(0, TIOCGLTC, (char *)&deflchars);
|
term.c_lflag &= ~(ICANON|IEXTEN|ECHO);
|
||||||
ioctl(0, TIOCGETD, (char *)&odisc);
|
term.c_iflag &= ~(INPCK|ICRNL);
|
||||||
arg = defarg;
|
term.c_oflag &= ~OPOST;
|
||||||
arg.sg_flags = ANYP | CBREAK;
|
term.c_cc[VMIN] = 1;
|
||||||
tchars = defchars;
|
term.c_cc[VTIME] = 0;
|
||||||
tchars.t_intrc = tchars.t_quitc = -1;
|
defchars = term;
|
||||||
ltchars = deflchars;
|
term.c_cc[VINTR] = term.c_cc[VQUIT] = term.c_cc[VSUSP] =
|
||||||
ltchars.t_suspc = ltchars.t_dsuspc = ltchars.t_flushc
|
term.c_cc[VDSUSP] = term.c_cc[VDISCARD] =
|
||||||
= ltchars.t_lnextc = -1;
|
term.c_cc[VLNEXT] = _POSIX_VDISABLE;
|
||||||
raw();
|
raw();
|
||||||
|
|
||||||
pipe(fildes); pipe(repdes);
|
pipe(fildes); pipe(repdes);
|
||||||
@ -280,11 +280,7 @@ shell_uid()
|
|||||||
*/
|
*/
|
||||||
raw()
|
raw()
|
||||||
{
|
{
|
||||||
|
tcsetattr(0, TCSADRAIN, &term);
|
||||||
ioctl(0, TIOCSETP, &arg);
|
|
||||||
ioctl(0, TIOCSETC, &tchars);
|
|
||||||
ioctl(0, TIOCSLTC, <chars);
|
|
||||||
ioctl(0, TIOCSETD, (char *)&disc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -293,11 +289,7 @@ raw()
|
|||||||
*/
|
*/
|
||||||
unraw()
|
unraw()
|
||||||
{
|
{
|
||||||
|
tcsetattr(0, TCSADRAIN, &defterm);
|
||||||
ioctl(0, TIOCSETD, (char *)&odisc);
|
|
||||||
ioctl(0, TIOCSETP, (char *)&defarg);
|
|
||||||
ioctl(0, TIOCSETC, (char *)&defchars);
|
|
||||||
ioctl(0, TIOCSLTC, (char *)&deflchars);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static jmp_buf promptbuf;
|
static jmp_buf promptbuf;
|
||||||
@ -363,7 +355,7 @@ tipin()
|
|||||||
}
|
}
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
gch = getchar()&0177;
|
gch = getchar()&STRIP_PAR;
|
||||||
if ((gch == character(value(ESCAPE))) && bol) {
|
if ((gch == character(value(ESCAPE))) && bol) {
|
||||||
if (!(gch = escape()))
|
if (!(gch = escape()))
|
||||||
continue;
|
continue;
|
||||||
@ -377,7 +369,7 @@ tipin()
|
|||||||
printf("\r\n");
|
printf("\r\n");
|
||||||
continue;
|
continue;
|
||||||
} else if (!cumode && gch == character(value(FORCE)))
|
} else if (!cumode && gch == character(value(FORCE)))
|
||||||
gch = getchar()&0177;
|
gch = getchar()&STRIP_PAR;
|
||||||
bol = any(gch, value(EOL));
|
bol = any(gch, value(EOL));
|
||||||
if (boolean(value(RAISE)) && islower(gch))
|
if (boolean(value(RAISE)) && islower(gch))
|
||||||
gch = toupper(gch);
|
gch = toupper(gch);
|
||||||
@ -399,7 +391,7 @@ escape()
|
|||||||
register esctable_t *p;
|
register esctable_t *p;
|
||||||
char c = character(value(ESCAPE));
|
char c = character(value(ESCAPE));
|
||||||
|
|
||||||
gch = (getchar()&0177);
|
gch = (getchar()&STRIP_PAR);
|
||||||
for (p = etable; p->e_char; p++)
|
for (p = etable; p->e_char; p++)
|
||||||
if (p->e_char == gch) {
|
if (p->e_char == gch) {
|
||||||
if ((p->e_flags&PRIV) && uid)
|
if ((p->e_flags&PRIV) && uid)
|
||||||
@ -419,10 +411,10 @@ speed(n)
|
|||||||
{
|
{
|
||||||
register int *p;
|
register int *p;
|
||||||
|
|
||||||
for (p = bauds; *p != -1; p++)
|
for (p = rates; *p != -1; p++)
|
||||||
if (*p == n)
|
if (*p == n)
|
||||||
return (p - bauds);
|
return n;
|
||||||
return (NULL);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
any(c, p)
|
any(c, p)
|
||||||
@ -511,14 +503,21 @@ help(c)
|
|||||||
ttysetup(speed)
|
ttysetup(speed)
|
||||||
int speed;
|
int speed;
|
||||||
{
|
{
|
||||||
unsigned bits = LDECCTQ;
|
struct termios cntrl;
|
||||||
|
|
||||||
arg.sg_ispeed = arg.sg_ospeed = speed;
|
tcgetattr(FD, &cntrl);
|
||||||
arg.sg_flags = RAW;
|
cfsetospeed(&cntrl, speed);
|
||||||
|
cfsetispeed(&cntrl, speed);
|
||||||
|
cntrl.c_cflag &= ~(CSIZE|PARENB);
|
||||||
|
cntrl.c_cflag |= CS8;
|
||||||
|
cntrl.c_iflag &= ~(ISTRIP|ICRNL);
|
||||||
|
cntrl.c_oflag &= ~OPOST;
|
||||||
|
cntrl.c_lflag &= ~(ICANON|ISIG|IEXTEN|ECHO);
|
||||||
|
cntrl.c_cc[VMIN] = 1;
|
||||||
|
cntrl.c_cc[VTIME] = 0;
|
||||||
if (boolean(value(TAND)))
|
if (boolean(value(TAND)))
|
||||||
arg.sg_flags |= TANDEM;
|
cntrl.c_iflag |= IXOFF;
|
||||||
ioctl(FD, TIOCSETP, (char *)&arg);
|
tcsetattr(FD, TCSAFLUSH, &cntrl);
|
||||||
ioctl(FD, TIOCLBIS, (char *)&bits);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -538,7 +537,6 @@ sname(s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static char partab[0200];
|
static char partab[0200];
|
||||||
static int bits8;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Do a write to the remote machine with the correct parity.
|
* Do a write to the remote machine with the correct parity.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: tip.h,v 1.3 1994/12/08 09:31:10 jtc Exp $ */
|
/* $NetBSD: tip.h,v 1.4 1995/10/29 00:49:43 pk Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1989, 1993
|
* Copyright (c) 1989, 1993
|
||||||
@ -45,7 +45,7 @@
|
|||||||
#include <sys/file.h>
|
#include <sys/file.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
|
||||||
#include <sgtty.h>
|
#include <termios.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -241,12 +241,9 @@ extern value_t vtable[]; /* variable table */
|
|||||||
#define NOFILE ((FILE *)NULL)
|
#define NOFILE ((FILE *)NULL)
|
||||||
#define NOPWD ((struct passwd *)0)
|
#define NOPWD ((struct passwd *)0)
|
||||||
|
|
||||||
struct sgttyb arg; /* current mode of local terminal */
|
struct termios term; /* current mode of terminal */
|
||||||
struct sgttyb defarg; /* initial mode of local terminal */
|
struct termios defterm; /* initial mode of terminal */
|
||||||
struct tchars tchars; /* current state of terminal */
|
struct termios defchars; /* current mode with initial chars */
|
||||||
struct tchars defchars; /* initial state of terminal */
|
|
||||||
struct ltchars ltchars; /* current local characters of terminal */
|
|
||||||
struct ltchars deflchars; /* initial local characters of terminal */
|
|
||||||
|
|
||||||
FILE *fscript; /* FILE for scripting */
|
FILE *fscript; /* FILE for scripting */
|
||||||
|
|
||||||
@ -265,6 +262,8 @@ int intflag; /* recognized interrupt */
|
|||||||
int stoprompt; /* for interrupting a prompt session */
|
int stoprompt; /* for interrupting a prompt session */
|
||||||
int timedout; /* ~> transfer timedout */
|
int timedout; /* ~> transfer timedout */
|
||||||
int cumode; /* simulating the "cu" program */
|
int cumode; /* simulating the "cu" program */
|
||||||
|
int bits8; /* terminal is is 8-bit mode */
|
||||||
|
#define STRIP_PAR (bits8 ? 0377 : 0177)
|
||||||
|
|
||||||
char fname[80]; /* file name buffer for ~< */
|
char fname[80]; /* file name buffer for ~< */
|
||||||
char copyname[80]; /* file name buffer for ~> */
|
char copyname[80]; /* file name buffer for ~> */
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: tipout.c,v 1.3 1994/12/08 09:31:12 jtc Exp $ */
|
/* $NetBSD: tipout.c,v 1.4 1995/10/29 00:49:45 pk Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1983, 1993
|
* Copyright (c) 1983, 1993
|
||||||
@ -37,7 +37,7 @@
|
|||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)tipout.c 8.1 (Berkeley) 6/6/93";
|
static char sccsid[] = "@(#)tipout.c 8.1 (Berkeley) 6/6/93";
|
||||||
#endif
|
#endif
|
||||||
static char rcsid[] = "$NetBSD: tipout.c,v 1.3 1994/12/08 09:31:12 jtc Exp $";
|
static char rcsid[] = "$NetBSD: tipout.c,v 1.4 1995/10/29 00:49:45 pk Exp $";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include "tip.h"
|
#include "tip.h"
|
||||||
@ -147,7 +147,7 @@ tipout()
|
|||||||
#define ALLSIGS sigmask(SIGEMT)|sigmask(SIGTERM)|sigmask(SIGIOT)|sigmask(SIGSYS)
|
#define ALLSIGS sigmask(SIGEMT)|sigmask(SIGTERM)|sigmask(SIGIOT)|sigmask(SIGSYS)
|
||||||
omask = sigblock(ALLSIGS);
|
omask = sigblock(ALLSIGS);
|
||||||
for (cp = buf; cp < buf + cnt; cp++)
|
for (cp = buf; cp < buf + cnt; cp++)
|
||||||
*cp &= 0177;
|
*cp &= STRIP_PAR;
|
||||||
write(1, buf, cnt);
|
write(1, buf, cnt);
|
||||||
if (boolean(value(SCRIPT)) && fscript != NULL) {
|
if (boolean(value(SCRIPT)) && fscript != NULL) {
|
||||||
if (!boolean(value(BEAUTIFY))) {
|
if (!boolean(value(BEAUTIFY))) {
|
||||||
|
Loading…
Reference in New Issue
Block a user