diff options
Diffstat (limited to 'usr.bin/tip/libacu/biz31.c')
-rw-r--r-- | usr.bin/tip/libacu/biz31.c | 59 |
1 files changed, 28 insertions, 31 deletions
diff --git a/usr.bin/tip/libacu/biz31.c b/usr.bin/tip/libacu/biz31.c index 5522d65..4151811 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; |