diff options
Diffstat (limited to 'usr.bin/tip/libacu')
| -rw-r--r-- | usr.bin/tip/libacu/biz22.c | 61 | ||||
| -rw-r--r-- | usr.bin/tip/libacu/biz31.c | 59 | ||||
| -rw-r--r-- | usr.bin/tip/libacu/courier.c | 81 | ||||
| -rw-r--r-- | usr.bin/tip/libacu/df.c | 41 | ||||
| -rw-r--r-- | usr.bin/tip/libacu/dn11.c | 30 | ||||
| -rw-r--r-- | usr.bin/tip/libacu/hayes.c | 69 | ||||
| -rw-r--r-- | usr.bin/tip/libacu/t3000.c | 99 | ||||
| -rw-r--r-- | usr.bin/tip/libacu/v3451.c | 45 | ||||
| -rw-r--r-- | usr.bin/tip/libacu/v831.c | 46 | ||||
| -rw-r--r-- | usr.bin/tip/libacu/ventel.c | 84 |
10 files changed, 273 insertions, 342 deletions
diff --git a/usr.bin/tip/libacu/biz22.c b/usr.bin/tip/libacu/biz22.c index cd5ca4acfcc8..920b42a5c412 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. * @@ -38,19 +34,20 @@ #if 0 static char sccsid[] = "@(#)biz22.c 8.1 (Berkeley) 6/6/93"; #endif -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 /* not lint */ #include "tip.h" #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 @@ -58,8 +55,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]; @@ -74,7 +70,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..."); @@ -95,61 +91,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; @@ -170,14 +160,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(); @@ -191,5 +180,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 5522d652aed0..41518112db49 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. * @@ -38,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)biz31.c 8.1 (Berkeley) 6/6/93"; #endif -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 /* not lint */ #include "tip.h" @@ -46,7 +42,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; @@ -56,8 +59,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; @@ -91,7 +93,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); } @@ -105,37 +107,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; @@ -157,17 +156,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; @@ -191,8 +189,7 @@ detect(s) } static int -flush(s) - char *s; +flush(char *s) { sig_t f; char c; @@ -215,7 +212,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 728ccc9f4377..cd642b6df0a7 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. * @@ -38,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)courier.c 8.1 (Berkeley) 6/6/93"; #endif -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 /* not lint */ /* @@ -51,19 +47,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 jmp_buf timeoutbuf; -void cour_disconnect __P((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 @@ -107,19 +106,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); @@ -130,29 +129,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); @@ -183,16 +182,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; @@ -206,7 +205,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; @@ -265,7 +264,7 @@ again: * the courier in sync. */ static int -coursync() +coursync(void) { int already = 0; int len; @@ -307,10 +306,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))) @@ -326,7 +322,8 @@ int n; } #ifdef DEBUG -cour_verbose_read() +static void +cour_verbose_read(void) { int n = 0; char buf[BUFSIZ]; @@ -342,8 +339,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 2fa0a0b320a1..f858d46fc053 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. * @@ -38,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)df.c 8.1 (Berkeley) 6/6/93"; #endif -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 /* not lint */ /* @@ -48,28 +44,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 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; @@ -102,7 +94,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); @@ -121,25 +113,22 @@ df_dialer(num, acu, df03) } void -df_disconnect() +df_disconnect(void) { write(FD, "\001", 1); sleep(1); 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 3f3461594296..01805ca76910 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. * @@ -38,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)dn11.c 8.1 (Berkeley) 6/6/93"; #endif -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 /* not lint */ /* @@ -46,14 +42,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; @@ -116,8 +111,9 @@ dn_dialer(num, acu) return (1); } -void -alarmtr() +/*ARGSUSED*/ +static void +alarmtr(int signo) { alarm(0); longjmp(jmpbuf, 1); @@ -128,9 +124,8 @@ alarmtr() * hanging up... */ void -dn_disconnect() +dn_disconnect(void) { - sleep(2); if (FD > 0) ioctl(FD, TIOCCDTR, 0); @@ -138,9 +133,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 19ee8f80abe6..e7139435b6b6 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. * @@ -38,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)hayes.c 8.1 (Berkeley) 6/6/93"; #endif -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 /* not lint */ /* @@ -71,10 +67,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 sigALRM(); -static int timeout = 0; +static int dialtimeout = 0; static jmp_buf timeoutbuf; -static char gobble(); + #define DUMBUFLEN 40 static char dumbuf[DUMBUFLEN]; @@ -84,10 +79,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; @@ -130,20 +129,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 @@ -156,32 +154,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 @@ -209,8 +205,7 @@ gobble(match) } static void -error_rep(c) - char c; +error_rep(char c) { printf("\n\r"); switch (c) { @@ -222,23 +217,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); } @@ -249,8 +244,8 @@ error_rep(c) /* * set modem back to normal verbose status codes. */ -void -goodbye() +static void +goodbye(void) { int len; char c; @@ -294,8 +289,8 @@ goodbye() #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 1f0509104475..1bb81c5d375a 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. * @@ -38,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)t3000.c 8.1 (Berkeley) 6/6/93"; #endif -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 /* not lint */ /* @@ -52,17 +48,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 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; @@ -106,19 +107,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); @@ -129,29 +130,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); @@ -188,24 +189,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; @@ -219,7 +220,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; @@ -278,7 +279,7 @@ again: * the t3000 in sync. */ static int -t3000_sync() +t3000_sync(void) { int already = 0; int len; @@ -322,11 +323,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))) @@ -342,7 +340,8 @@ int n; } #ifdef DEBUG -t3000_verbose_read() +static void +t3000_verbose_read(void) { int n = 0; char buf[BUFSIZ]; @@ -358,8 +357,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 1440c551e0e0..96624409f274 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. * @@ -38,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)v3451.c 8.1 (Berkeley) 6/6/93"; #endif -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 /* not lint */ /* @@ -48,13 +44,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; @@ -128,32 +125,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; @@ -190,17 +181,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); @@ -208,8 +198,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 005e5d931e52..383a540f1f6d 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. * @@ -38,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)v831.c 8.1 (Berkeley) 6/6/93"; #endif -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 /* not lint */ /* @@ -47,20 +43,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..."); @@ -119,8 +114,9 @@ v831_dialer(num, acu) return (1); } +/*ARGSUSED*/ static void -alarmtr() +alarmtr(int signo) { alarm(0); longjmp(jmpbuf, 1); @@ -131,7 +127,7 @@ alarmtr() * hanging up... */ void -v831_disconnect() +v831_disconnect(void) { struct termios cntrl; @@ -151,18 +147,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); @@ -188,9 +183,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; @@ -250,8 +243,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 48035c177d2d..04ca30e61998 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. * @@ -38,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)ventel.c 8.1 (Berkeley) 6/6/93"; #endif -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 /* not lint */ /* @@ -51,12 +47,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 @@ -69,9 +66,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; @@ -106,21 +101,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) { @@ -138,63 +133,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++) != NULL) + 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); @@ -222,7 +213,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]; @@ -263,4 +254,3 @@ vensync(fd) } return (0); } - |
