summaryrefslogtreecommitdiffstats
path: root/usr.bin/tip/libacu
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2006-08-31 14:14:30 +0000
committerru <ru@FreeBSD.org>2006-08-31 14:14:30 +0000
commit37ec4940b5d4527c95f64ee6ab92b1e9a5faf872 (patch)
treee07e374074319669440c07525e33e34a59954293 /usr.bin/tip/libacu
parentf4be069346f4731f63dbe66bdcbd368851ea6bd9 (diff)
downloadFreeBSD-src-37ec4940b5d4527c95f64ee6ab92b1e9a5faf872.zip
FreeBSD-src-37ec4940b5d4527c95f64ee6ab92b1e9a5faf872.tar.gz
Resolve merge conflicts.
Diffstat (limited to 'usr.bin/tip/libacu')
-rw-r--r--usr.bin/tip/libacu/biz22.c61
-rw-r--r--usr.bin/tip/libacu/biz31.c59
-rw-r--r--usr.bin/tip/libacu/courier.c82
-rw-r--r--usr.bin/tip/libacu/df.c42
-rw-r--r--usr.bin/tip/libacu/dn11.c30
-rw-r--r--usr.bin/tip/libacu/hayes.c67
-rw-r--r--usr.bin/tip/libacu/t3000.c100
-rw-r--r--usr.bin/tip/libacu/v3451.c45
-rw-r--r--usr.bin/tip/libacu/v831.c46
-rw-r--r--usr.bin/tip/libacu/ventel.c84
10 files changed, 271 insertions, 345 deletions
diff --git a/usr.bin/tip/libacu/biz22.c b/usr.bin/tip/libacu/biz22.c
index 2794ba7..99b6fb0 100644
--- a/usr.bin/tip/libacu/biz22.c
+++ b/usr.bin/tip/libacu/biz22.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: biz22.c,v 1.7 2001/10/24 18:38:58 millert Exp $ */
+/* $OpenBSD: biz22.c,v 1.13 2006/03/17 19:17:13 moritz Exp $ */
/* $NetBSD: biz22.c,v 1.6 1997/02/11 09:24:11 mrg Exp $ */
/*
@@ -13,11 +13,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -40,7 +36,7 @@ __FBSDID("$FreeBSD$");
#ifndef lint
#if 0
static char sccsid[] = "@(#)biz22.c 8.1 (Berkeley) 6/6/93";
-static char rcsid[] = "$OpenBSD: biz22.c,v 1.7 2001/10/24 18:38:58 millert Exp $";
+static const char rcsid[] = "$OpenBSD: biz22.c,v 1.13 2006/03/17 19:17:13 moritz Exp $";
#endif
#endif /* not lint */
@@ -48,12 +44,13 @@ static char rcsid[] = "$OpenBSD: biz22.c,v 1.7 2001/10/24 18:38:58 millert Exp $
#define DISCONNECT_CMD "\20\04" /* disconnection string */
-static void sigALRM();
-static int timeout = 0;
+static int dialtimeout = 0;
static jmp_buf timeoutbuf;
-static int cmd(), detect();
-void biz22_disconnect();
+static int biz_dialer(char *, char *);
+static void sigALRM(int);
+static int cmd(char *);
+static int detect(char *);
/*
* Dial up on a BIZCOMP Model 1022 with either
@@ -61,8 +58,7 @@ void biz22_disconnect();
* pulse dialing (mod = "W")
*/
static int
-biz_dialer(num, mod)
- char *num, *mod;
+biz_dialer(char *num, char *mod)
{
int connected = 0;
char cbuf[40];
@@ -77,7 +73,7 @@ biz_dialer(num, mod)
printf("can't initialize bizcomp...");
return (0);
}
- (void)strcpy(cbuf, "\02.\r");
+ (void)strlcpy(cbuf, "\02.\r", sizeof cbuf);
cbuf[1] = *mod;
if (cmd(cbuf)) {
printf("can't set dialing mode...");
@@ -98,61 +94,55 @@ biz_dialer(num, mod)
*/
connected = detect("1\r");
#ifdef ACULOG
- if (timeout) {
+ if (dialtimeout) {
char line[80];
- (void)sprintf(line, "%ld second dial timeout",
+ (void)snprintf(line, sizeof line, "%ld second dial timeout",
number(value(DIALTIMEOUT)));
logent(value(HOST), num, "biz1022", line);
}
#endif
- if (timeout)
+ if (dialtimeout)
biz22_disconnect(); /* insurance */
return (connected);
}
int
-biz22w_dialer(num, acu)
- char *num, *acu;
+biz22w_dialer(char *num, char *acu)
{
-
return (biz_dialer(num, "W"));
}
int
-biz22f_dialer(num, acu)
- char *num, *acu;
+biz22f_dialer(char *num, char *acu)
{
-
return (biz_dialer(num, "V"));
}
void
-biz22_disconnect()
+biz22_disconnect(void)
{
- write(FD, DISCONNECT_CMD, 4);
+ write(FD, DISCONNECT_CMD, sizeof(DISCONNECT_CMD)-1);
sleep(2);
tcflush(FD, TCIOFLUSH);
}
void
-biz22_abort()
+biz22_abort(void)
{
-
write(FD, "\02", 1);
}
+/*ARGSUSED*/
static void
-sigALRM()
+sigALRM(int signo)
{
-
- timeout = 1;
+ dialtimeout = 1;
longjmp(timeoutbuf, 1);
}
static int
-cmd(s)
- char *s;
+cmd(char *s)
{
sig_t f;
char c;
@@ -173,14 +163,13 @@ cmd(s)
}
static int
-detect(s)
- char *s;
+detect(char *s)
{
sig_t f;
char c;
f = signal(SIGALRM, sigALRM);
- timeout = 0;
+ dialtimeout = 0;
while (*s) {
if (setjmp(timeoutbuf)) {
biz22_abort();
@@ -194,5 +183,5 @@ detect(s)
return (0);
}
signal(SIGALRM, f);
- return (timeout == 0);
+ return (dialtimeout == 0);
}
diff --git a/usr.bin/tip/libacu/biz31.c b/usr.bin/tip/libacu/biz31.c
index 44b8a62..5bc00ae 100644
--- a/usr.bin/tip/libacu/biz31.c
+++ b/usr.bin/tip/libacu/biz31.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: biz31.c,v 1.6 2001/10/24 18:38:58 millert Exp $ */
+/* $OpenBSD: biz31.c,v 1.10 2006/03/17 19:17:13 moritz Exp $ */
/* $NetBSD: biz31.c,v 1.5 1997/02/11 09:24:14 mrg Exp $ */
/*
@@ -13,11 +13,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -40,7 +36,7 @@ __FBSDID("$FreeBSD$");
#ifndef lint
#if 0
static char sccsid[] = "@(#)biz31.c 8.1 (Berkeley) 6/6/93";
-static char rcsid[] = "$OpenBSD: biz31.c,v 1.6 2001/10/24 18:38:58 millert Exp $";
+static char rcsid[] = "$OpenBSD: biz31.c,v 1.10 2006/03/17 19:17:13 moritz Exp $";
#endif
#endif /* not lint */
@@ -49,7 +45,14 @@ static char rcsid[] = "$OpenBSD: biz31.c,v 1.6 2001/10/24 18:38:58 millert Exp $
#define MAXRETRY 3 /* sync up retry count */
#define DISCONNECT_CMD "\21\25\11\24" /* disconnection string */
-static void sigALRM();
+static int biz_dialer(char *, char *);
+static int bizsync(int);
+static int echo(char *);
+static void sigALRM(int);
+static int detect(char *);
+static int flush(char *);
+static int bizsync(int);
+
static int timeout = 0;
static jmp_buf timeoutbuf;
@@ -59,8 +62,7 @@ static jmp_buf timeoutbuf;
* pulse dialing (mod = "w")
*/
static int
-biz_dialer(num, mod)
- char *num, *mod;
+biz_dialer(char *num, char *mod)
{
int connected = 0;
@@ -94,7 +96,7 @@ biz_dialer(num, mod)
if (timeout) {
char line[80];
- (void)sprintf(line, "%ld second dial timeout",
+ (void)snprintf(line, sizeof line, "%ld second dial timeout",
number(value(DIALTIMEOUT)));
logent(value(HOST), num, "biz", line);
}
@@ -108,37 +110,34 @@ biz_dialer(num, mod)
return (connected);
}
-biz31w_dialer(num, acu)
- char *num, *acu;
+int
+biz31w_dialer(char *num, char *acu)
{
-
return (biz_dialer(num, "w"));
}
-biz31f_dialer(num, acu)
- char *num, *acu;
+int
+biz31f_dialer(char *num, char *acu)
{
-
return (biz_dialer(num, "f"));
}
-biz31_disconnect()
+void
+biz31_disconnect(void)
{
-
- write(FD, DISCONNECT_CMD, 4);
+ write(FD, DISCONNECT_CMD, sizeof(DISCONNECT_CMD)-1);
sleep(2);
tcflush(FD, TCIOFLUSH);
}
-biz31_abort()
+void
+biz31_abort(void)
{
-
write(FD, "\33", 1);
}
static int
-echo(s)
- char *s;
+echo(char *s)
{
char c;
@@ -160,17 +159,16 @@ echo(s)
}
}
+/*ARGSUSED*/
static void
-sigALRM()
+sigALRM(int signo)
{
-
timeout = 1;
longjmp(timeoutbuf, 1);
}
static int
-detect(s)
- char *s;
+detect(char *s)
{
sig_t f;
char c;
@@ -194,8 +192,7 @@ detect(s)
}
static int
-flush(s)
- char *s;
+flush(char *s)
{
sig_t f;
char c;
@@ -218,7 +215,7 @@ flush(s)
* call there are gory ways to simulate this.
*/
static int
-bizsync(fd)
+bizsync(int fd)
{
#ifdef FIOCAPACITY
struct capacity b;
diff --git a/usr.bin/tip/libacu/courier.c b/usr.bin/tip/libacu/courier.c
index 598dbab..b23c28c 100644
--- a/usr.bin/tip/libacu/courier.c
+++ b/usr.bin/tip/libacu/courier.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: courier.c,v 1.9 2001/10/24 18:38:58 millert Exp $ */
+/* $OpenBSD: courier.c,v 1.15 2006/03/17 19:17:13 moritz Exp $ */
/* $NetBSD: courier.c,v 1.7 1997/02/11 09:24:16 mrg Exp $ */
/*
@@ -13,11 +13,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -40,7 +36,7 @@ __FBSDID("$FreeBSD$");
#ifndef lint
#if 0
static char sccsid[] = "@(#)courier.c 8.1 (Berkeley) 6/6/93";
-static char rcsid[] = "$OpenBSD: courier.c,v 1.9 2001/10/24 18:38:58 millert Exp $";
+static const char rcsid[] = "$OpenBSD: courier.c,v 1.15 2006/03/17 19:17:13 moritz Exp $";
#endif
#endif /* not lint */
@@ -54,20 +50,22 @@ static char rcsid[] = "$OpenBSD: courier.c,v 1.9 2001/10/24 18:38:58 millert Exp
#define MAXRETRY 5
-static void sigALRM();
-static int timeout = 0;
+static int dialtimeout = 0;
static int connected = 0;
-static jmp_buf timeoutbuf, intbuf;
-static int coursync(), cour_connect(), cour_swallow();
-void cour_nap();
-static void cour_write(int fd, char *cp, int n);
+static jmp_buf timeoutbuf;
-void cour_disconnect(void);
+static void sigALRM(int);
+static int cour_swallow(char *);
+static int cour_connect(void);
+static int coursync(void);
+static void cour_write(int, char *, int);
+static void cour_nap(void);
+#ifdef DEBUG
+static void cour_verbose_read(void);
+#endif
int
-cour_dialer(num, acu)
- char *num;
- char *acu;
+cour_dialer(char *num, char *acu)
{
char *cp;
#ifdef ACULOG
@@ -111,19 +109,19 @@ badsynch:
cour_write(FD, "\r", 1);
connected = cour_connect();
#ifdef ACULOG
- if (timeout) {
- (void)sprintf(line, "%ld second dial timeout",
+ if (dialtimeout) {
+ (void)snprintf(line, sizeof line, "%ld second dial timeout",
number(value(DIALTIMEOUT)));
logent(value(HOST), num, "cour", line);
}
#endif
- if (timeout)
+ if (dialtimeout)
cour_disconnect();
return (connected);
}
void
-cour_disconnect()
+cour_disconnect(void)
{
/* first hang up the modem*/
ioctl(FD, TIOCCDTR, 0);
@@ -134,29 +132,29 @@ cour_disconnect()
}
void
-cour_abort()
+cour_abort(void)
{
cour_write(FD, "\r", 1); /* send anything to abort the call */
cour_disconnect();
}
+/*ARGSUSED*/
static void
-sigALRM()
+sigALRM(int signo)
{
printf("\07timeout waiting for reply\n");
- timeout = 1;
+ dialtimeout = 1;
longjmp(timeoutbuf, 1);
}
static int
-cour_swallow(match)
- char *match;
+cour_swallow(char *match)
{
sig_t f;
char c;
f = signal(SIGALRM, sigALRM);
- timeout = 0;
+ dialtimeout = 0;
do {
if (*match =='\0') {
signal(SIGALRM, f);
@@ -187,16 +185,16 @@ struct baud_msg {
char *msg;
int baud;
} baud_msg[] = {
- "", B300,
- " 1200", B1200,
- " 2400", B2400,
- " 9600", B9600,
- " 9600/ARQ", B9600,
- 0, 0,
+ { "", B300 },
+ { " 1200", B1200 },
+ { " 2400", B2400 },
+ { " 9600", B9600 },
+ { " 9600/ARQ", B9600 },
+ { 0, 0 },
};
static int
-cour_connect()
+cour_connect(void)
{
char c;
int nc, nl, n;
@@ -210,7 +208,7 @@ cour_connect()
again:
nc = 0; nl = sizeof(dialer_buf)-1;
bzero(dialer_buf, sizeof(dialer_buf));
- timeout = 0;
+ dialtimeout = 0;
for (nc = 0, nl = sizeof(dialer_buf)-1 ; nl > 0 ; nc++, nl--) {
if (setjmp(timeoutbuf))
break;
@@ -269,7 +267,7 @@ again:
* the courier in sync.
*/
static int
-coursync()
+coursync(void)
{
int already = 0;
int len;
@@ -311,10 +309,7 @@ coursync()
}
static void
-cour_write(fd, cp, n)
-int fd;
-char *cp;
-int n;
+cour_write(int fd, char *cp, int n)
{
#ifdef notdef
if (boolean(value(VERBOSE)))
@@ -330,7 +325,8 @@ int n;
}
#ifdef DEBUG
-cour_verbose_read()
+static void
+cour_verbose_read(void)
{
int n = 0;
char buf[BUFSIZ];
@@ -346,8 +342,8 @@ cour_verbose_read()
#endif
/* Give the courier 50 milliseconds between characters */
-void
-cour_nap()
+static void
+cour_nap(void)
{
struct timespec ts;
diff --git a/usr.bin/tip/libacu/df.c b/usr.bin/tip/libacu/df.c
index 7d11271..03374e1 100644
--- a/usr.bin/tip/libacu/df.c
+++ b/usr.bin/tip/libacu/df.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: df.c,v 1.5 2001/10/24 18:38:58 millert Exp $ */
+/* $OpenBSD: df.c,v 1.9 2006/03/17 19:17:13 moritz Exp $ */
/* $NetBSD: df.c,v 1.4 1995/10/29 00:49:51 pk Exp $ */
/*
@@ -13,11 +13,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -40,7 +36,7 @@ __FBSDID("$FreeBSD$");
#ifndef lint
#if 0
static char sccsid[] = "@(#)df.c 8.1 (Berkeley) 6/6/93";
-static char rcsid[] = "$OpenBSD: df.c,v 1.5 2001/10/24 18:38:58 millert Exp $";
+static const char rcsid[] = "$OpenBSD: df.c,v 1.9 2006/03/17 19:17:13 moritz Exp $";
#endif
#endif /* not lint */
@@ -51,29 +47,24 @@ static char rcsid[] = "$OpenBSD: df.c,v 1.5 2001/10/24 18:38:58 millert Exp $";
#include "tip.h"
static jmp_buf Sjbuf;
-static void timeout();
-static void df_disconnect(void);
+
+static int df_dialer(char *, char *, int);
+static void alrm_timeout(int);
int
-df02_dialer(num, acu)
- char *num, *acu;
+df02_dialer(char *num, char *acu)
{
-
return (df_dialer(num, acu, 0));
}
int
-df03_dialer(num, acu)
- char *num, *acu;
+df03_dialer(char *num, char *acu)
{
-
return (df_dialer(num, acu, 1));
}
-int
-df_dialer(num, acu, df03)
- char *num, *acu;
- int df03;
+static int
+df_dialer(char *num, char *acu, int df03)
{
int f = FD;
struct termios cntrl;
@@ -106,7 +97,7 @@ df_dialer(num, acu, df03)
ioctl(f, TIOCMBIS, &st); /* set ST for 1200 baud */
}
#endif
- signal(SIGALRM, timeout);
+ signal(SIGALRM, alrm_timeout);
alarm(5 * strlen(num) + 10);
tcflush(f, TCIOFLUSH);
write(f, "\001", 1);
@@ -124,7 +115,7 @@ df_dialer(num, acu, df03)
return (c == 'A');
}
-static void
+void
df_disconnect(void)
{
write(FD, "\001", 1);
@@ -132,18 +123,15 @@ df_disconnect(void)
tcflush(FD, TCIOFLUSH);
}
-
void
-df_abort()
+df_abort(void)
{
-
df_disconnect();
}
-
+/*ARGSUSED*/
static void
-timeout()
+alrm_timeout(int signo)
{
-
longjmp(Sjbuf, 1);
}
diff --git a/usr.bin/tip/libacu/dn11.c b/usr.bin/tip/libacu/dn11.c
index ea78cce..a0b18ba 100644
--- a/usr.bin/tip/libacu/dn11.c
+++ b/usr.bin/tip/libacu/dn11.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dn11.c,v 1.5 2001/11/19 19:02:16 mpech Exp $ */
+/* $OpenBSD: dn11.c,v 1.9 2006/03/17 19:17:13 moritz Exp $ */
/* $NetBSD: dn11.c,v 1.4 1995/10/29 00:49:53 pk Exp $ */
/*
@@ -13,11 +13,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -40,7 +36,7 @@ __FBSDID("$FreeBSD$");
#ifndef lint
#if 0
static char sccsid[] = "@(#)dn11.c 8.1 (Berkeley) 6/6/93";
-static char rcsid[] = "$OpenBSD: dn11.c,v 1.5 2001/11/19 19:02:16 mpech Exp $";
+static const char rcsid[] = "$OpenBSD: dn11.c,v 1.9 2006/03/17 19:17:13 moritz Exp $";
#endif
#endif /* not lint */
@@ -49,14 +45,13 @@ static char rcsid[] = "$OpenBSD: dn11.c,v 1.5 2001/11/19 19:02:16 mpech Exp $";
*/
#include "tip.h"
-void dn_abort();
-void alarmtr();
static jmp_buf jmpbuf;
-static int child = -1, dn;
+static pid_t child = -1, dn;
+
+static void alarmtr(int);
int
-dn_dialer(num, acu)
- char *num, *acu;
+dn_dialer(char *num, char *acu)
{
int lt, nw;
int timelim;
@@ -119,8 +114,9 @@ dn_dialer(num, acu)
return (1);
}
-void
-alarmtr()
+/*ARGSUSED*/
+static void
+alarmtr(int signo)
{
alarm(0);
longjmp(jmpbuf, 1);
@@ -131,9 +127,8 @@ alarmtr()
* hanging up...
*/
void
-dn_disconnect()
+dn_disconnect(void)
{
-
sleep(2);
if (FD > 0)
ioctl(FD, TIOCCDTR, 0);
@@ -141,9 +136,8 @@ dn_disconnect()
}
void
-dn_abort()
+dn_abort(void)
{
-
sleep(2);
if (child > 0)
kill(child, SIGKILL);
diff --git a/usr.bin/tip/libacu/hayes.c b/usr.bin/tip/libacu/hayes.c
index 7784f29..9e38830 100644
--- a/usr.bin/tip/libacu/hayes.c
+++ b/usr.bin/tip/libacu/hayes.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hayes.c,v 1.8 2001/10/24 18:38:58 millert Exp $ */
+/* $OpenBSD: hayes.c,v 1.13 2006/03/17 19:17:13 moritz Exp $ */
/* $NetBSD: hayes.c,v 1.6 1997/02/11 09:24:17 mrg Exp $ */
/*
@@ -13,11 +13,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -40,7 +36,7 @@ __FBSDID("$FreeBSD$");
#ifndef lint
#if 0
static char sccsid[] = "@(#)hayes.c 8.1 (Berkeley) 6/6/93";
-static char rcsid[] = "$OpenBSD: hayes.c,v 1.8 2001/10/24 18:38:58 millert Exp $";
+static const char rcsid[] = "$OpenBSD: hayes.c,v 1.13 2006/03/17 19:17:13 moritz Exp $";
#endif
#endif /* not lint */
@@ -74,12 +70,9 @@ static char rcsid[] = "$OpenBSD: hayes.c,v 1.8 2001/10/24 18:38:58 millert Exp $
#define min(a,b) ((a < b) ? a : b)
-static void error_rep(char c);
-static void goodbye(void);
-static void sigALRM();
-static int timeout = 0;
+static int dialtimeout = 0;
static jmp_buf timeoutbuf;
-static char gobble();
+
#define DUMBUFLEN 40
static char dumbuf[DUMBUFLEN];
@@ -89,10 +82,14 @@ static char dumbuf[DUMBUFLEN];
#define FAILED 4
static int state = IDLE;
+static void sigALRM(int);
+static char gobble(char *);
+static void error_rep(char);
+static void goodbye(void);
+static int hay_sync(void);
+
int
-hay_dialer(num, acu)
- char *num;
- char *acu;
+hay_dialer(char *num, char *acu)
{
char *cp;
int connected = 0;
@@ -135,20 +132,19 @@ hay_dialer(num, acu)
}
tcflush(FD, TCIOFLUSH);
#ifdef ACULOG
- if (timeout) {
- (void)sprintf(line, "%ld second dial timeout",
+ if (dialtimeout) {
+ (void)snprintf(line, sizeof line, "%ld second dial timeout",
number(value(DIALTIMEOUT)));
logent(value(HOST), num, "hayes", line);
}
#endif
- if (timeout)
+ if (dialtimeout)
hay_disconnect(); /* insurance */
return (connected);
}
-
void
-hay_disconnect()
+hay_disconnect(void)
{
/* first hang up the modem*/
#ifdef DEBUG
@@ -161,32 +157,30 @@ hay_disconnect()
}
void
-hay_abort()
+hay_abort(void)
{
-
write(FD, "\r", 1); /* send anything to abort the call */
hay_disconnect();
}
+/*ARGSUSED*/
static void
-sigALRM()
+sigALRM(int signo)
{
-
printf("\07timeout waiting for reply\n\r");
- timeout = 1;
+ dialtimeout = 1;
longjmp(timeoutbuf, 1);
}
static char
-gobble(match)
- char *match;
+gobble(char *match)
{
char c;
sig_t f;
int i, status = 0;
f = signal(SIGALRM, sigALRM);
- timeout = 0;
+ dialtimeout = 0;
#ifdef DEBUG
printf("\ngobble: waiting for %s\n", match);
#endif
@@ -214,8 +208,7 @@ gobble(match)
}
static void
-error_rep(c)
- char c;
+error_rep(char c)
{
printf("\n\r");
switch (c) {
@@ -227,23 +220,23 @@ error_rep(c)
case '1':
printf("CONNECT");
break;
-
+
case '2':
printf("RING");
break;
-
+
case '3':
printf("NO CARRIER");
break;
-
+
case '4':
printf("ERROR in input");
break;
-
+
case '5':
printf("CONNECT 1200");
break;
-
+
default:
printf("Unknown Modem error: %c (0x%x)", c, c);
}
@@ -299,8 +292,8 @@ goodbye(void)
#define MAXRETRY 5
-int
-hay_sync()
+static int
+hay_sync(void)
{
int len, retry = 0;
diff --git a/usr.bin/tip/libacu/t3000.c b/usr.bin/tip/libacu/t3000.c
index ec9c3d4..a640ff3 100644
--- a/usr.bin/tip/libacu/t3000.c
+++ b/usr.bin/tip/libacu/t3000.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: t3000.c,v 1.9 2001/10/24 18:38:58 millert Exp $ */
+/* $OpenBSD: t3000.c,v 1.14 2006/03/17 19:17:13 moritz Exp $ */
/* $NetBSD: t3000.c,v 1.5 1997/02/11 09:24:18 mrg Exp $ */
/*
@@ -13,11 +13,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -40,7 +36,7 @@ __FBSDID("$FreeBSD$");
#ifndef lint
#if 0
static char sccsid[] = "@(#)t3000.c 8.1 (Berkeley) 6/6/93";
-static char rcsid[] = "$OpenBSD: t3000.c,v 1.9 2001/10/24 18:38:58 millert Exp $";
+static const char rcsid[] = "$OpenBSD: t3000.c,v 1.14 2006/03/17 19:17:13 moritz Exp $";
#endif
#endif /* not lint */
@@ -55,18 +51,22 @@ static char rcsid[] = "$OpenBSD: t3000.c,v 1.9 2001/10/24 18:38:58 millert Exp $
#define MAXRETRY 5
-static void sigALRM();
-static int timeout = 0;
+static int dialtimeout = 0;
static int connected = 0;
-static jmp_buf timeoutbuf, intbuf;
-static int t3000_sync(), t3000_connect(), t3000_swallow();
-static void t3000_nap();
-static int t3000_write(int fd, char *cp, int n);
+static jmp_buf timeoutbuf;
+
+static void sigALRM(int);
+static int t3000_swallow(char *);
+static int t3000_connect(void);
+static int t3000_sync(void);
+static void t3000_write(int, char *, int);
+static void t3000_nap(void);
+#ifdef DEBUG
+static void t3000_verbose_read(void);
+#endif
int
-t3000_dialer(num, acu)
- char *num;
- char *acu;
+t3000_dialer(char *num, char *acu)
{
char *cp;
struct termios cntrl;
@@ -110,19 +110,19 @@ badsynch:
t3000_write(FD, "\r", 1);
connected = t3000_connect();
#ifdef ACULOG
- if (timeout) {
- (void)sprintf(line, "%ld second dial timeout",
+ if (dialtimeout) {
+ (void)snprintf(line, sizeof line, "%ld second dial timeout",
number(value(DIALTIMEOUT)));
logent(value(HOST), num, "t3000", line);
}
#endif
- if (timeout)
+ if (dialtimeout)
t3000_disconnect();
return (connected);
}
void
-t3000_disconnect()
+t3000_disconnect(void)
{
/* first hang up the modem*/
ioctl(FD, TIOCCDTR, 0);
@@ -133,29 +133,29 @@ t3000_disconnect()
}
void
-t3000_abort()
+t3000_abort(void)
{
t3000_write(FD, "\r", 1); /* send anything to abort the call */
t3000_disconnect();
}
+/*ARGSUSED*/
static void
-sigALRM()
+sigALRM(int signo)
{
printf("\07timeout waiting for reply\n");
- timeout = 1;
+ dialtimeout = 1;
longjmp(timeoutbuf, 1);
}
static int
-t3000_swallow(match)
- char *match;
+t3000_swallow(char *match)
{
sig_t f;
char c;
f = signal(SIGALRM, sigALRM);
- timeout = 0;
+ dialtimeout = 0;
do {
if (*match =='\0') {
signal(SIGALRM, f);
@@ -192,24 +192,24 @@ struct tbaud_msg {
int baud;
int baud2;
} tbaud_msg[] = {
- "", B300, 0,
- " 1200", B1200, 0,
- " 2400", B2400, 0,
- " 4800", B4800, 0,
- " 9600", B9600, 0,
- " 14400", B19200, B9600,
- " 19200", B19200, B9600,
- " 38400", B38400, B9600,
- " 57600", B38400, B9600,
- " 7512", B9600, 0,
- " 1275", B2400, 0,
- " 7200", B9600, 0,
- " 12000", B19200, B9600,
- 0, 0, 0,
+ { "", B300, 0 },
+ { " 1200", B1200, 0 },
+ { " 2400", B2400, 0 },
+ { " 4800", B4800, 0 },
+ { " 9600", B9600, 0 },
+ { " 14400", B19200, B9600 },
+ { " 19200", B19200, B9600 },
+ { " 38400", B38400, B9600 },
+ { " 57600", B38400, B9600 },
+ { " 7512", B9600, 0 },
+ { " 1275", B2400, 0 },
+ { " 7200", B9600, 0 },
+ { " 12000", B19200, B9600 },
+ { 0, 0, 0 },
};
static int
-t3000_connect()
+t3000_connect(void)
{
char c;
int nc, nl, n;
@@ -223,7 +223,7 @@ t3000_connect()
again:
nc = 0; nl = sizeof(dialer_buf)-1;
bzero(dialer_buf, sizeof(dialer_buf));
- timeout = 0;
+ dialtimeout = 0;
for (nc = 0, nl = sizeof(dialer_buf)-1 ; nl > 0 ; nc++, nl--) {
if (setjmp(timeoutbuf))
break;
@@ -282,7 +282,7 @@ again:
* the t3000 in sync.
*/
static int
-t3000_sync()
+t3000_sync(void)
{
int already = 0;
int len;
@@ -326,11 +326,8 @@ if (len == 0) len = 1;
return (0);
}
-static int
-t3000_write(fd, cp, n)
-int fd;
-char *cp;
-int n;
+static void
+t3000_write(int fd, char *cp, int n)
{
#ifdef notdef
if (boolean(value(VERBOSE)))
@@ -346,7 +343,8 @@ int n;
}
#ifdef DEBUG
-t3000_verbose_read()
+static void
+t3000_verbose_read(void)
{
int n = 0;
char buf[BUFSIZ];
@@ -362,8 +360,8 @@ t3000_verbose_read()
#endif
/* Give the t3000 50 milliseconds between characters */
-void
-t3000_nap()
+static void
+t3000_nap(void)
{
struct timespec ts;
diff --git a/usr.bin/tip/libacu/v3451.c b/usr.bin/tip/libacu/v3451.c
index df850a5..0de679e 100644
--- a/usr.bin/tip/libacu/v3451.c
+++ b/usr.bin/tip/libacu/v3451.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: v3451.c,v 1.6 2001/10/24 18:38:58 millert Exp $ */
+/* $OpenBSD: v3451.c,v 1.9 2006/03/17 19:17:13 moritz Exp $ */
/* $NetBSD: v3451.c,v 1.6 1997/02/11 09:24:20 mrg Exp $ */
/*
@@ -13,11 +13,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -40,7 +36,7 @@ __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 $";
+static const char rcsid[] = "$OpenBSD: v3451.c,v 1.9 2006/03/17 19:17:13 moritz Exp $";
#endif
#endif /* not lint */
@@ -51,13 +47,14 @@ static char rcsid[] = "$OpenBSD: v3451.c,v 1.6 2001/10/24 18:38:58 millert Exp $
static jmp_buf Sjbuf;
-static int expect(), notin(), prefix();
-static void vawrite(), alarmtr();
+static void vawrite(char *, int);
+static int expect(char *);
+static void alarmtr(int);
+static int notin(char *, char *);
+static int prefix(char *, char *);
int
-v3451_dialer(num, acu)
- char *num;
- char *acu;
+v3451_dialer(char *num, char *acu)
{
sig_t func;
int ok;
@@ -131,32 +128,26 @@ v3451_dialer(num, acu)
}
void
-v3451_disconnect()
+v3451_disconnect(void)
{
-
close(FD);
}
void
-v3451_abort()
+v3451_abort(void)
{
-
close(FD);
}
static void
-vawrite(cp, delay)
- char *cp;
- int delay;
+vawrite(char *cp, int delay)
{
-
for (; *cp; sleep(delay), cp++)
write(FD, cp, 1);
}
static int
-expect(cp)
- char *cp;
+expect(char *cp)
{
char buf[300];
char *rp = buf;
@@ -193,17 +184,16 @@ expect(cp)
return (1);
}
+/*ARGSUSED*/
static void
-alarmtr()
+alarmtr(int signo)
{
longjmp(Sjbuf, 1);
}
static int
-notin(sh, lg)
- char *sh, *lg;
+notin(char *sh, char *lg)
{
-
for (; *lg; lg++)
if (prefix(sh, lg))
return (0);
@@ -211,8 +201,7 @@ notin(sh, lg)
}
static int
-prefix(s1, s2)
- char *s1, *s2;
+prefix(char *s1, char *s2)
{
char c;
diff --git a/usr.bin/tip/libacu/v831.c b/usr.bin/tip/libacu/v831.c
index 5a6268e..95770eb 100644
--- a/usr.bin/tip/libacu/v831.c
+++ b/usr.bin/tip/libacu/v831.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: v831.c,v 1.6 2001/11/19 19:02:16 mpech Exp $ */
+/* $OpenBSD: v831.c,v 1.11 2006/03/17 19:17:13 moritz Exp $ */
/* $NetBSD: v831.c,v 1.5 1996/12/29 10:42:01 cgd Exp $ */
/*
@@ -13,11 +13,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -40,7 +36,7 @@ __FBSDID("$FreeBSD$");
#ifndef lint
#if 0
static char sccsid[] = "@(#)v831.c 8.1 (Berkeley) 6/6/93";
-static char rcsid[] = "$OpenBSD: v831.c,v 1.6 2001/11/19 19:02:16 mpech Exp $";
+static const char rcsid[] = "$OpenBSD: v831.c,v 1.11 2006/03/17 19:17:13 moritz Exp $";
#endif
#endif /* not lint */
@@ -50,20 +46,19 @@ static char rcsid[] = "$OpenBSD: v831.c,v 1.6 2001/11/19 19:02:16 mpech Exp $";
#include "tip.h"
#include <termios.h>
-void v831_abort();
-static void alarmtr();
-static int dialit();
-static char *sanitize();
-
static jmp_buf jmpbuf;
-static int child = -1;
+static pid_t child = -1;
+
+static void alarmtr(int);
+static int dialit(char *, char *);
+static char * sanitize(char *);
int
-v831_dialer(num, acu)
- char *num, *acu;
+v831_dialer(char *num, char *acu)
{
- int status, pid;
+ int status;
int timelim;
+ pid_t pid;
if (boolean(value(VERBOSE)))
printf("\nstarting call...");
@@ -122,8 +117,9 @@ v831_dialer(num, acu)
return (1);
}
+/*ARGSUSED*/
static void
-alarmtr()
+alarmtr(int signo)
{
alarm(0);
longjmp(jmpbuf, 1);
@@ -134,7 +130,7 @@ alarmtr()
* hanging up...
*/
void
-v831_disconnect()
+v831_disconnect(void)
{
struct termios cntrl;
@@ -154,18 +150,17 @@ v831_disconnect()
}
void
-v831_abort()
+v831_abort(void)
{
-
#ifdef DEBUG
printf("[abort: AC=%d]\n", AC);
#endif
sleep(2);
if (child > 0)
kill(child, SIGKILL);
- if (AC > 0)
+ if (FD > 0)
ioctl(FD, TIOCNXCL, NULL);
- close(AC);
+ close(AC);
if (FD > 0)
ioctl(FD, TIOCCDTR, 0);
close(FD);
@@ -191,9 +186,7 @@ struct vaconfig {
#define ETX 03
static int
-dialit(phonenum, acu)
- char *phonenum;
- char *acu;
+dialit(char *phonenum, char *acu)
{
struct vaconfig *vp;
struct termios cntrl;
@@ -253,8 +246,7 @@ dialit(phonenum, acu)
}
static char *
-sanitize(s)
- char *s;
+sanitize(char *s)
{
static char buf[128];
char *cp;
diff --git a/usr.bin/tip/libacu/ventel.c b/usr.bin/tip/libacu/ventel.c
index c3b87ae..399b5d8 100644
--- a/usr.bin/tip/libacu/ventel.c
+++ b/usr.bin/tip/libacu/ventel.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ventel.c,v 1.7 2001/11/19 19:02:16 mpech Exp $ */
+/* $OpenBSD: ventel.c,v 1.12 2006/03/17 19:17:13 moritz Exp $ */
/* $NetBSD: ventel.c,v 1.6 1997/02/11 09:24:21 mrg Exp $ */
/*
@@ -13,11 +13,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -40,7 +36,7 @@ __FBSDID("$FreeBSD$");
#ifndef lint
#if 0
static char sccsid[] = "@(#)ventel.c 8.1 (Berkeley) 6/6/93";
-static char rcsid[] = "$OpenBSD: ventel.c,v 1.7 2001/11/19 19:02:16 mpech Exp $";
+static const char rcsid[] = "$OpenBSD: ventel.c,v 1.12 2006/03/17 19:17:13 moritz Exp $";
#endif
#endif /* not lint */
@@ -54,12 +50,13 @@ static char rcsid[] = "$OpenBSD: ventel.c,v 1.7 2001/11/19 19:02:16 mpech Exp $"
#define MAXRETRY 5
-static void sigALRM();
-static int timeout = 0;
+static int dialtimeout = 0;
static jmp_buf timeoutbuf;
-static int gobble(), vensync();
-static void echo();
+static void echo(char *);
+static void sigALRM(int);
+static int gobble(char, char *);
+static int vensync(int);
/*
* some sleep calls have been replaced by this macro
@@ -72,9 +69,7 @@ static void echo();
#define busyloop(n) do { DELAY(n); } while (0)
int
-ven_dialer(num, acu)
- char *num;
- char *acu;
+ven_dialer(char *num, char *acu)
{
char *cp;
int connected = 0;
@@ -109,21 +104,21 @@ ven_dialer(num, acu)
connected = gobble('!', line);
tcflush(FD, TCIOFLUSH);
#ifdef ACULOG
- if (timeout) {
- (void)sprintf(line, "%ld second dial timeout",
+ if (dialtimeout) {
+ (void)snprintf(line, sizeof line, "%ld second dial timeout",
number(value(DIALTIMEOUT)));
logent(value(HOST), num, "ventel", line);
}
#endif
- if (timeout)
+ if (dialtimeout)
ven_disconnect(); /* insurance */
- if (connected || timeout || !boolean(value(VERBOSE)))
+ if (connected || dialtimeout || !boolean(value(VERBOSE)))
return (connected);
/* call failed, parse response for user */
cp = strchr(line, '\r');
if (cp)
*cp = '\0';
- for (cp = line; cp = strchr(cp, ' '); cp++)
+ for (cp = line; (cp = strchr(cp, ' ')) != NULL; cp++)
if (cp[1] == ' ')
break;
if (cp) {
@@ -141,63 +136,59 @@ ven_dialer(num, acu)
}
void
-ven_disconnect()
+ven_disconnect(void)
{
-
close(FD);
}
void
-ven_abort()
+ven_abort(void)
{
-
write(FD, "\03", 1);
close(FD);
}
static void
-echo(s)
- char *s;
+echo(char *s)
{
char c;
- while (c = *s++) switch (c) {
-
- case '$':
- read(FD, &c, 1);
- s++;
- break;
+ while ((c = *s++) != '\0')
+ switch (c) {
+ case '$':
+ read(FD, &c, 1);
+ s++;
+ break;
- case '#':
- c = *s++;
- write(FD, &c, 1);
- break;
+ case '#':
+ c = *s++;
+ write(FD, &c, 1);
+ break;
- default:
- write(FD, &c, 1);
- read(FD, &c, 1);
- }
+ default:
+ write(FD, &c, 1);
+ read(FD, &c, 1);
+ }
}
+/*ARGSUSED*/
static void
-sigALRM()
+sigALRM(int signo)
{
printf("\07timeout waiting for reply\n");
- timeout = 1;
+ dialtimeout = 1;
longjmp(timeoutbuf, 1);
}
static int
-gobble(match, response)
- char match;
- char response[];
+gobble(char match, char response[])
{
char *cp = response;
sig_t f;
char c;
f = signal(SIGALRM, sigALRM);
- timeout = 0;
+ dialtimeout = 0;
do {
if (setjmp(timeoutbuf)) {
signal(SIGALRM, f);
@@ -225,7 +216,7 @@ gobble(match, response)
* there are gory ways to simulate this.
*/
static int
-vensync(fd)
+vensync(int fd)
{
int already = 0, nread;
char buf[60];
@@ -266,4 +257,3 @@ vensync(fd)
}
return (0);
}
-
OpenPOWER on IntegriCloud