diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1997-04-02 01:47:09 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1997-04-02 01:47:09 +0000 |
commit | 030dcde987345aefe1f3a302590b3bea15bb9d9f (patch) | |
tree | 131fa6470d49f58f09aadf2d0a48750242c5ff14 | |
parent | 7bb2316828ce1d059124018af00067d5020f2397 (diff) |
Merge in good changes from NetBSD:
Compile in strcict ansi (some day I'll get around to -Wall)
use set* functions instead of modifying the lvalue
Change a few sprintf() to snprintf() where it coudl possibly matter.
Replace zzhack stuff with something saner to make tip work on alpha
-rw-r--r-- | usr.bin/tip/Makefile | 9 | ||||
-rw-r--r-- | usr.bin/tip/acu.c | 8 | ||||
-rw-r--r-- | usr.bin/tip/aculib/biz22.c | 17 | ||||
-rw-r--r-- | usr.bin/tip/aculib/biz31.c | 8 | ||||
-rw-r--r-- | usr.bin/tip/aculib/courier.c | 14 | ||||
-rw-r--r-- | usr.bin/tip/aculib/hayes.c | 8 | ||||
-rw-r--r-- | usr.bin/tip/aculib/t3000.c | 14 | ||||
-rw-r--r-- | usr.bin/tip/aculib/v3451.c | 17 | ||||
-rw-r--r-- | usr.bin/tip/aculib/v831.c | 10 | ||||
-rw-r--r-- | usr.bin/tip/aculib/ventel.c | 13 | ||||
-rw-r--r-- | usr.bin/tip/cmds.c | 15 | ||||
-rw-r--r-- | usr.bin/tip/cu.c | 10 | ||||
-rw-r--r-- | usr.bin/tip/partab.c | 8 | ||||
-rw-r--r-- | usr.bin/tip/remote.c | 30 | ||||
-rw-r--r-- | usr.bin/tip/tip.c | 12 | ||||
-rw-r--r-- | usr.bin/tip/tip.h | 32 | ||||
-rw-r--r-- | usr.bin/tip/tipout.c | 12 | ||||
-rw-r--r-- | usr.bin/tip/uucplock.c | 8 | ||||
-rw-r--r-- | usr.bin/tip/value.c | 21 |
19 files changed, 124 insertions, 142 deletions
diff --git a/usr.bin/tip/Makefile b/usr.bin/tip/Makefile index d76fe7e3ec7..1a1f48837c3 100644 --- a/usr.bin/tip/Makefile +++ b/usr.bin/tip/Makefile @@ -1,5 +1,6 @@ -# $OpenBSD: Makefile,v 1.3 1996/07/26 20:35:31 dm Exp $ -# $NetBSD: Makefile,v 1.4 1994/12/08 09:30:36 jtc Exp $ +# $OpenBSD: Makefile,v 1.4 1997/04/02 01:47:00 millert Exp $ +# $NetBSD: Makefile,v 1.5 1996/12/29 10:36:37 cgd Exp $ +# @(#)Makefile 8.1 (Berkeley) 6/6/93 # # Files are: # /etc/remote remote host description file @@ -32,13 +33,13 @@ # CONNECT enable ~C command (connect pgm to remote) PROG= tip -CFLAGS+=-I${.CURDIR} \ +CFLAGS+=-I${.CURDIR} -ansi -pedantic \ -DDEFBR=1200 -DDEFFS=BUFSIZ -DACULOG -DPRISTINE -DCONNECT \ -DV831 -DVENTEL -DHAYES -DCOURIER -DT3000 .PATH: ${.CURDIR}/aculib BINOWN= uucp BINGRP= dialer -BINMODE=4554 +BINMODE=4510 SRCS= acu.c acutab.c cmds.c cmdtab.c cu.c hunt.c log.c partab.c \ remote.c tip.c tipout.c uucplock.c value.c vars.c \ biz22.c courier.c df.c dn11.c hayes.c t3000.c v3451.c v831.c ventel.c diff --git a/usr.bin/tip/acu.c b/usr.bin/tip/acu.c index 68cc61885cb..01ddbcb5b1d 100644 --- a/usr.bin/tip/acu.c +++ b/usr.bin/tip/acu.c @@ -1,5 +1,5 @@ -/* $OpenBSD: acu.c,v 1.2 1996/06/26 05:40:40 deraadt Exp $ */ -/* $NetBSD: acu.c,v 1.3 1994/12/08 09:30:39 jtc Exp $ */ +/* $OpenBSD: acu.c,v 1.3 1997/04/02 01:47:01 millert Exp $ */ +/* $NetBSD: acu.c,v 1.4 1996/12/29 10:34:03 cgd Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)acu.c 8.1 (Berkeley) 6/6/93"; #endif -static char rcsid[] = "$OpenBSD: acu.c,v 1.2 1996/06/26 05:40:40 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: acu.c,v 1.3 1997/04/02 01:47:01 millert Exp $"; #endif /* not lint */ #include "tip.h" @@ -90,7 +90,7 @@ connect() printf("\ncall aborted\n"); logent(value(HOST), "", "", "call aborted"); if (acu != NOACU) { - boolean(value(VERBOSE)) = FALSE; + setboolean(value(VERBOSE), FALSE); if (conflag) disconnect(NOSTR); else diff --git a/usr.bin/tip/aculib/biz22.c b/usr.bin/tip/aculib/biz22.c index 8d642df4c61..acfb291a4cf 100644 --- a/usr.bin/tip/aculib/biz22.c +++ b/usr.bin/tip/aculib/biz22.c @@ -1,5 +1,5 @@ -/* $OpenBSD: biz22.c,v 1.3 1996/06/26 05:40:51 deraadt Exp $ */ -/* $NetBSD: biz22.c,v 1.4 1995/10/29 00:49:47 pk Exp $ */ +/* $OpenBSD: biz22.c,v 1.4 1997/04/02 01:47:05 millert Exp $ */ +/* $NetBSD: biz22.c,v 1.6 1997/02/11 09:24:11 mrg Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)biz22.c 8.1 (Berkeley) 6/6/93"; #endif -static char rcsid[] = "$OpenBSD: biz22.c,v 1.3 1996/06/26 05:40:51 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: biz22.c,v 1.4 1997/04/02 01:47:05 millert Exp $"; #endif /* not lint */ #include "tip.h" @@ -49,6 +49,8 @@ static void sigALRM(); static int timeout = 0; static jmp_buf timeoutbuf; +static int cmd(), detect(); + /* * Dial up on a BIZCOMP Model 1022 with either * tone dialing (mod = "V") @@ -60,7 +62,6 @@ biz_dialer(num, mod) { register int connected = 0; char cbuf[40]; - static int cmd(), detect(); if (boolean(value(VERBOSE))) printf("\nstarting call..."); @@ -72,15 +73,13 @@ biz_dialer(num, mod) printf("can't initialize bizcomp..."); return (0); } - strcpy(cbuf, "\02.\r"); + (void)strcpy(cbuf, "\02.\r"); cbuf[1] = *mod; if (cmd(cbuf)) { printf("can't set dialing mode..."); return (0); } - strcpy(cbuf, "\02D"); - strcat(cbuf, num); - strcat(cbuf, "\r"); + (void)snprintf(cbuf, sizeof(cbuf), "\02D%s\r", num); write(FD, cbuf, strlen(cbuf)); if (!detect("7\r")) { printf("can't get dial tone..."); @@ -98,7 +97,7 @@ biz_dialer(num, mod) if (timeout) { char line[80]; - sprintf(line, "%d second dial timeout", + (void)sprintf(line, "%d second dial timeout", number(value(DIALTIMEOUT))); logent(value(HOST), num, "biz1022", line); } diff --git a/usr.bin/tip/aculib/biz31.c b/usr.bin/tip/aculib/biz31.c index a3b0e4185e5..96c99372e57 100644 --- a/usr.bin/tip/aculib/biz31.c +++ b/usr.bin/tip/aculib/biz31.c @@ -1,5 +1,5 @@ -/* $OpenBSD: biz31.c,v 1.3 1996/06/26 05:40:51 deraadt Exp $ */ -/* $NetBSD: biz31.c,v 1.4 1995/10/29 00:49:48 pk Exp $ */ +/* $OpenBSD: biz31.c,v 1.4 1997/04/02 01:47:06 millert Exp $ */ +/* $NetBSD: biz31.c,v 1.5 1997/02/11 09:24:14 mrg Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)biz31.c 8.1 (Berkeley) 6/6/93"; #endif -static char rcsid[] = "$OpenBSD: biz31.c,v 1.3 1996/06/26 05:40:51 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: biz31.c,v 1.4 1997/04/02 01:47:06 millert Exp $"; #endif /* not lint */ #include "tip.h" @@ -91,7 +91,7 @@ biz_dialer(num, mod) if (timeout) { char line[80]; - sprintf(line, "%d second dial timeout", + (void)sprintf(line, "%d second dial timeout", number(value(DIALTIMEOUT))); logent(value(HOST), num, "biz", line); } diff --git a/usr.bin/tip/aculib/courier.c b/usr.bin/tip/aculib/courier.c index 36b64b9e8c3..669af03ad6f 100644 --- a/usr.bin/tip/aculib/courier.c +++ b/usr.bin/tip/aculib/courier.c @@ -1,5 +1,5 @@ -/* $OpenBSD: courier.c,v 1.4 1997/01/17 07:13:34 millert Exp $ */ -/* $NetBSD: courier.c,v 1.5 1995/10/29 00:49:50 pk Exp $ */ +/* $OpenBSD: courier.c,v 1.5 1997/04/02 01:47:06 millert Exp $ */ +/* $NetBSD: courier.c,v 1.7 1997/02/11 09:24:16 mrg Exp $ */ /* * Copyright (c) 1986, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)courier.c 8.1 (Berkeley) 6/6/93"; #endif -static char rcsid[] = "$OpenBSD: courier.c,v 1.4 1997/01/17 07:13:34 millert Exp $"; +static char rcsid[] = "$OpenBSD: courier.c,v 1.5 1997/04/02 01:47:06 millert Exp $"; #endif /* not lint */ /* @@ -55,7 +55,8 @@ static void sigALRM(); static int timeout = 0; static int connected = 0; static jmp_buf timeoutbuf, intbuf; -static int coursync(); +static int coursync(), cour_connect(), cour_swallow(); +static void cour_napx(); cour_dialer(num, acu) register char *num; @@ -66,7 +67,6 @@ cour_dialer(num, acu) char line[80]; #endif struct termios cntrl; - static int cour_connect(), cour_swallow(); if (boolean(value(VERBOSE))) printf("Using \"%s\"\n", acu); @@ -105,7 +105,7 @@ badsynch: connected = cour_connect(); #ifdef ACULOG if (timeout) { - sprintf(line, "%d second dial timeout", + (void)sprintf(line, "%d second dial timeout", number(value(DIALTIMEOUT))); logent(value(HOST), num, "cour", line); } @@ -350,8 +350,6 @@ static int ringring; cour_nap() { - - static void cour_napx(); int omask; struct itimerval itv, oitv; register struct itimerval *itp = &itv; diff --git a/usr.bin/tip/aculib/hayes.c b/usr.bin/tip/aculib/hayes.c index d5b28f33859..7a0649c81b9 100644 --- a/usr.bin/tip/aculib/hayes.c +++ b/usr.bin/tip/aculib/hayes.c @@ -1,5 +1,5 @@ -/* $OpenBSD: hayes.c,v 1.5 1997/01/17 07:13:36 millert Exp $ */ -/* $NetBSD: hayes.c,v 1.5 1996/11/01 23:56:33 cgd Exp $ */ +/* $OpenBSD: hayes.c,v 1.6 1997/04/02 01:47:06 millert Exp $ */ +/* $NetBSD: hayes.c,v 1.6 1997/02/11 09:24:17 mrg Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)hayes.c 8.1 (Berkeley) 6/6/93"; #endif -static char rcsid[] = "$OpenBSD: hayes.c,v 1.5 1997/01/17 07:13:36 millert Exp $"; +static char rcsid[] = "$OpenBSD: hayes.c,v 1.6 1997/04/02 01:47:06 millert Exp $"; #endif /* not lint */ /* @@ -130,7 +130,7 @@ hay_dialer(num, acu) tcflush(FD, TCIOFLUSH); #ifdef ACULOG if (timeout) { - sprintf(line, "%d second dial timeout", + (void)sprintf(line, "%d second dial timeout", number(value(DIALTIMEOUT))); logent(value(HOST), num, "hayes", line); } diff --git a/usr.bin/tip/aculib/t3000.c b/usr.bin/tip/aculib/t3000.c index 57a3a10fb1f..e8f0972e533 100644 --- a/usr.bin/tip/aculib/t3000.c +++ b/usr.bin/tip/aculib/t3000.c @@ -1,5 +1,5 @@ -/* $OpenBSD: t3000.c,v 1.4 1997/01/17 07:13:37 millert Exp $ */ -/* $NetBSD: t3000.c,v 1.3 1995/10/29 00:49:57 pk Exp $ */ +/* $OpenBSD: t3000.c,v 1.5 1997/04/02 01:47:07 millert Exp $ */ +/* $NetBSD: t3000.c,v 1.5 1997/02/11 09:24:18 mrg Exp $ */ /* * Copyright (c) 1992, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)t3000.c 8.1 (Berkeley) 6/6/93"; #endif -static char rcsid[] = "$OpenBSD: t3000.c,v 1.4 1997/01/17 07:13:37 millert Exp $"; +static char rcsid[] = "$OpenBSD: t3000.c,v 1.5 1997/04/02 01:47:07 millert Exp $"; #endif /* not lint */ /* @@ -56,7 +56,8 @@ static void sigALRM(); static int timeout = 0; static int connected = 0; static jmp_buf timeoutbuf, intbuf; -static int t3000_sync(); +static int t3000_sync(), t3000_connect(), t3000_swallow(); +static void t3000_napx(); t3000_dialer(num, acu) register char *num; @@ -67,7 +68,6 @@ t3000_dialer(num, acu) #ifdef ACULOG char line[80]; #endif - static int t3000_connect(), t3000_swallow(); if (boolean(value(VERBOSE))) printf("Using \"%s\"\n", acu); @@ -106,7 +106,7 @@ badsynch: connected = t3000_connect(); #ifdef ACULOG if (timeout) { - sprintf(line, "%d second dial timeout", + (void)sprintf(line, "%d second dial timeout", number(value(DIALTIMEOUT))); logent(value(HOST), num, "t3000", line); } @@ -368,8 +368,6 @@ static int ringring; t3000_nap() { - - static void t3000_napx(); int omask; struct itimerval itv, oitv; register struct itimerval *itp = &itv; diff --git a/usr.bin/tip/aculib/v3451.c b/usr.bin/tip/aculib/v3451.c index 214d0d769ae..f7388f43d01 100644 --- a/usr.bin/tip/aculib/v3451.c +++ b/usr.bin/tip/aculib/v3451.c @@ -1,5 +1,5 @@ -/* $OpenBSD: v3451.c,v 1.3 1996/06/26 05:40:55 deraadt Exp $ */ -/* $NetBSD: v3451.c,v 1.4 1995/10/29 00:49:59 pk Exp $ */ +/* $OpenBSD: v3451.c,v 1.4 1997/04/02 01:47:07 millert Exp $ */ +/* $NetBSD: v3451.c,v 1.6 1997/02/11 09:24:20 mrg Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)v3451.c 8.1 (Berkeley) 6/6/93"; #endif -static char rcsid[] = "$OpenBSD: v3451.c,v 1.3 1996/06/26 05:40:55 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: v3451.c,v 1.4 1997/04/02 01:47:07 millert Exp $"; #endif /* not lint */ /* @@ -48,6 +48,9 @@ static char rcsid[] = "$OpenBSD: v3451.c,v 1.3 1996/06/26 05:40:55 deraadt Exp $ static jmp_buf Sjbuf; +static int expect(), notin(), prefix(); +static void vawrite(), alarmtr(); + v3451_dialer(num, acu) register char *num; char *acu; @@ -60,8 +63,6 @@ v3451_dialer(num, acu) #ifdef ACULOG char line[80]; #endif - static int expect(); - static void vawrite(); /* * Get in synch @@ -89,8 +90,7 @@ v3451_dialer(num, acu) #endif return (0); } - strcpy(phone, num); - strcat(phone, "\r"); + (void)snprintf(phone, sizeof phone, "%s\r", num); vawrite(phone, 1 + slow); if (!expect(phone)) { printf("Vadic will not accept phone number\n"); @@ -158,8 +158,6 @@ expect(cp) char buf[300]; register char *rp = buf; int timeout = 30, online = 0; - static int notin(); - static void alarmtr(); if (strcmp(cp, "\"\"") == 0) return (1); @@ -202,7 +200,6 @@ static int notin(sh, lg) char *sh, *lg; { - static int prefix(); for (; *lg; lg++) if (prefix(sh, lg)) diff --git a/usr.bin/tip/aculib/v831.c b/usr.bin/tip/aculib/v831.c index 48cfbbb31a0..af9e1b48cce 100644 --- a/usr.bin/tip/aculib/v831.c +++ b/usr.bin/tip/aculib/v831.c @@ -1,5 +1,5 @@ -/* $OpenBSD: v831.c,v 1.3 1996/06/26 05:40:56 deraadt Exp $ */ -/* $NetBSD: v831.c,v 1.4 1995/10/29 00:50:02 pk Exp $ */ +/* $OpenBSD: v831.c,v 1.4 1997/04/02 01:47:08 millert Exp $ */ +/* $NetBSD: v831.c,v 1.5 1996/12/29 10:42:01 cgd Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)v831.c 8.1 (Berkeley) 6/6/93"; #endif -static char rcsid[] = "$OpenBSD: v831.c,v 1.3 1996/06/26 05:40:56 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: v831.c,v 1.4 1997/04/02 01:47:08 millert Exp $"; #endif /* not lint */ /* @@ -49,6 +49,8 @@ static char rcsid[] = "$OpenBSD: v831.c,v 1.3 1996/06/26 05:40:56 deraadt Exp $" int v831_abort(); static void alarmtr(); +static int dialit(); +static char *sanitize(); extern int errno; static jmp_buf jmpbuf; @@ -59,7 +61,6 @@ v831_dialer(num, acu) { int status, pid, connected = 1; register int timelim; - static int dialit(); if (boolean(value(VERBOSE))) printf("\nstarting call..."); @@ -193,7 +194,6 @@ dialit(phonenum, acu) struct termios cntrl; char c; int i, two = 2; - static char *sanitize(); phonenum = sanitize(phonenum); #ifdef DEBUG diff --git a/usr.bin/tip/aculib/ventel.c b/usr.bin/tip/aculib/ventel.c index a885710ce52..0628b0e9b9d 100644 --- a/usr.bin/tip/aculib/ventel.c +++ b/usr.bin/tip/aculib/ventel.c @@ -1,5 +1,5 @@ -/* $OpenBSD: ventel.c,v 1.4 1997/01/17 07:13:38 millert Exp $ */ -/* $NetBSD: ventel.c,v 1.4 1995/10/29 00:50:04 pk Exp $ */ +/* $OpenBSD: ventel.c,v 1.5 1997/04/02 01:47:08 millert Exp $ */ +/* $NetBSD: ventel.c,v 1.6 1997/02/11 09:24:21 mrg Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)ventel.c 8.1 (Berkeley) 6/6/93"; #endif -static char rcsid[] = "$OpenBSD: ventel.c,v 1.4 1997/01/17 07:13:38 millert Exp $"; +static char rcsid[] = "$OpenBSD: ventel.c,v 1.5 1997/04/02 01:47:08 millert Exp $"; #endif /* not lint */ /* @@ -55,6 +55,9 @@ static void sigALRM(); static int timeout = 0; static jmp_buf timeoutbuf; +static int gobble(), vensync(); +static void echo(); + /* * some sleep calls have been replaced by this macro * because some ventel modems require two <cr>s in less than @@ -72,8 +75,6 @@ ven_dialer(num, acu) register char *cp; register int connected = 0; char *msg, line[80]; - static int gobble(), vensync(); - static void echo(); struct termios cntrl; /* @@ -105,7 +106,7 @@ ven_dialer(num, acu) tcflush(FD, TCIOFLUSH); #ifdef ACULOG if (timeout) { - sprintf(line, "%d second dial timeout", + (void)sprintf(line, "%d second dial timeout", number(value(DIALTIMEOUT))); logent(value(HOST), num, "ventel", line); } diff --git a/usr.bin/tip/cmds.c b/usr.bin/tip/cmds.c index f80e1e71f88..96ca35c5f68 100644 --- a/usr.bin/tip/cmds.c +++ b/usr.bin/tip/cmds.c @@ -1,5 +1,5 @@ -/* $OpenBSD: cmds.c,v 1.4 1996/10/15 23:47:20 millert Exp $ */ -/* $NetBSD: cmds.c,v 1.6 1995/10/29 00:49:38 pk Exp $ */ +/* $OpenBSD: cmds.c,v 1.5 1997/04/02 01:47:01 millert Exp $ */ +/* $NetBSD: cmds.c,v 1.7 1997/02/11 09:24:03 mrg Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)cmds.c 8.1 (Berkeley) 6/6/93"; #endif -static char rcsid[] = "$OpenBSD: cmds.c,v 1.4 1996/10/15 23:47:20 millert Exp $"; +static char rcsid[] = "$OpenBSD: cmds.c,v 1.5 1997/04/02 01:47:01 millert Exp $"; #endif /* not lint */ #include "tip.h" @@ -113,7 +113,7 @@ cu_take(cc) printf("\r\n%s: cannot create\r\n", argv[1]); return; } - snprintf(line, sizeof(line), "cat %s;echo \01", argv[0]); + (void)snprintf(line, sizeof(line), "cat %s;echo \01", argv[0]); transfer(line, fd, "\01"); } @@ -400,9 +400,10 @@ cu_put(cc) return; } if (boolean(value(ECHOCHECK))) - snprintf(line, sizeof(line), "cat>%s\r", argv[1]); + (void)snprintf(line, sizeof(line), "cat>%s\r", argv[1]); else - snprintf(line, sizeof(line), "stty -echo;cat>%s;stty echo\r", argv[1]); + (void)snprintf(line, sizeof(line), + "stty -echo;cat>%s;stty echo\r", argv[1]); transmit(fd, "\04", line); } @@ -824,7 +825,7 @@ expand(name) /* signal(SIGINT, sigint) */ return(name); } - snprintf(cmdbuf, sizeof(cmdbuf), "echo %s", name); + (void)snprintf(cmdbuf, sizeof(cmdbuf), "echo %s", name); if ((pid = vfork()) == 0) { Shell = value(SHELL); if (Shell == NOSTR) diff --git a/usr.bin/tip/cu.c b/usr.bin/tip/cu.c index dc9d8a7ab5d..269ba10aa47 100644 --- a/usr.bin/tip/cu.c +++ b/usr.bin/tip/cu.c @@ -1,5 +1,5 @@ -/* $OpenBSD: cu.c,v 1.2 1996/06/26 05:40:43 deraadt Exp $ */ -/* $NetBSD: cu.c,v 1.3 1994/12/08 09:30:48 jtc Exp $ */ +/* $OpenBSD: cu.c,v 1.3 1997/04/02 01:47:02 millert Exp $ */ +/* $NetBSD: cu.c,v 1.5 1997/02/11 09:24:05 mrg Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)cu.c 8.1 (Berkeley) 6/6/93"; #endif -static char rcsid[] = "$OpenBSD: cu.c,v 1.2 1996/06/26 05:40:43 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: cu.c,v 1.3 1997/04/02 01:47:02 millert Exp $"; #endif /* not lint */ #include "tip.h" @@ -109,7 +109,7 @@ cumain(argc, argv) * The "cu" host name is used to define the * attributes of the generic dialer. */ - (void)sprintf(sbuf, "cu%d", BR); + (void)snprintf(sbuf, sizeof(sbuf), "cu%d", BR); if ((i = hunt(sbuf)) == 0) { printf("all ports busy\n"); exit(3); @@ -124,7 +124,7 @@ cumain(argc, argv) user_uid(); vinit(); setparity("none"); - boolean(value(VERBOSE)) = 0; + setboolean(value(VERBOSE), 0); if (HW) ttysetup(speed(BR)); if (connect()) { diff --git a/usr.bin/tip/partab.c b/usr.bin/tip/partab.c index 53419ea86f4..b0e4dc2f732 100644 --- a/usr.bin/tip/partab.c +++ b/usr.bin/tip/partab.c @@ -1,5 +1,5 @@ -/* $OpenBSD: partab.c,v 1.2 1996/06/26 05:40:44 deraadt Exp $ */ -/* $NetBSD: partab.c,v 1.3 1994/12/08 09:30:55 jtc Exp $ */ +/* $OpenBSD: partab.c,v 1.3 1997/04/02 01:47:02 millert Exp $ */ +/* $NetBSD: partab.c,v 1.4 1996/12/29 10:38:21 cgd Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,13 +38,13 @@ #if 0 static char sccsid[] = "@(#)partab.c 8.1 (Berkeley) 6/6/93"; #endif -static char rcsid[] = "$OpenBSD: partab.c,v 1.2 1996/06/26 05:40:44 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: partab.c,v 1.3 1997/04/02 01:47:02 millert Exp $"; #endif /* not lint */ /* * Even parity table for 0-0177 */ -char evenpartab[] = { +const unsigned char evenpartab[] = { 0000,0201,0202,0003,0204,0005,0006,0207, 0210,0011,0012,0213,0014,0215,0216,0017, 0220,0021,0022,0223,0024,0225,0226,0027, diff --git a/usr.bin/tip/remote.c b/usr.bin/tip/remote.c index 4e5e8447528..52b7aa08e43 100644 --- a/usr.bin/tip/remote.c +++ b/usr.bin/tip/remote.c @@ -1,5 +1,5 @@ -/* $OpenBSD: remote.c,v 1.3 1996/10/15 23:47:21 millert Exp $ */ -/* $NetBSD: remote.c,v 1.3 1994/12/08 09:31:03 jtc Exp $ */ +/* $OpenBSD: remote.c,v 1.4 1997/04/02 01:47:02 millert Exp $ */ +/* $NetBSD: remote.c,v 1.4 1996/12/29 10:34:08 cgd Exp $ */ /* * Copyright (c) 1992, 1993 @@ -45,7 +45,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)remote.c 8.1 (Berkeley) 6/6/93"; #endif -static char rcsid[] = "$OpenBSD: remote.c,v 1.3 1996/10/15 23:47:21 millert Exp $"; +static char rcsid[] = "$OpenBSD: remote.c,v 1.4 1997/04/02 01:47:02 millert Exp $"; #endif /* not lint */ #include <stdio.h> @@ -154,29 +154,29 @@ getremcap(host) * see if uppercase mode should be turned on initially */ if (cgetflag("ra")) - boolean(value(RAISE)) = 1; + setboolean(value(RAISE), 1); if (cgetflag("ec")) - boolean(value(ECHOCHECK)) = 1; + setboolean(value(ECHOCHECK), 1); if (cgetflag("be")) - boolean(value(BEAUTIFY)) = 1; + setboolean(value(BEAUTIFY), 1); if (cgetflag("nb")) - boolean(value(BEAUTIFY)) = 0; + setboolean(value(BEAUTIFY), 0); if (cgetflag("sc")) - boolean(value(SCRIPT)) = 1; + setboolean(value(SCRIPT), 1); if (cgetflag("tb")) - boolean(value(TABEXPAND)) = 1; + setboolean(value(TABEXPAND), 1); if (cgetflag("vb")) - boolean(value(VERBOSE)) = 1; + setboolean(value(VERBOSE), 1); if (cgetflag("nv")) - boolean(value(VERBOSE)) = 0; + setboolean(value(VERBOSE), 0); if (cgetflag("ta")) - boolean(value(TAND)) = 1; + setboolean(value(TAND), 1); if (cgetflag("nt")) - boolean(value(TAND)) = 0; + setboolean(value(TAND), 0); if (cgetflag("rw")) - boolean(value(RAWFTP)) = 1; + setboolean(value(RAWFTP), 1); if (cgetflag("hd")) - boolean(value(HALFDUPLEX)) = 1; + setboolean(value(HALFDUPLEX), 1); if (RE == NOSTR) RE = (char *)"tip.record"; if (EX == NOSTR) diff --git a/usr.bin/tip/tip.c b/usr.bin/tip/tip.c index f7084050a25..f208c15c662 100644 --- a/usr.bin/tip/tip.c +++ b/usr.bin/tip/tip.c @@ -1,5 +1,5 @@ -/* $OpenBSD: tip.c,v 1.3 1996/06/26 05:40:47 deraadt Exp $ */ -/* $NetBSD: tip.c,v 1.8 1995/10/29 00:49:42 pk Exp $ */ +/* $OpenBSD: tip.c,v 1.4 1997/04/02 01:47:03 millert Exp $ */ +/* $NetBSD: tip.c,v 1.11 1997/02/11 09:24:06 mrg Exp $ */ /* * Copyright (c) 1983, 1993 @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)tip.c 8.1 (Berkeley) 6/6/93"; #endif -static char rcsid[] = "$OpenBSD: tip.c,v 1.3 1996/06/26 05:40:47 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: tip.c,v 1.4 1997/04/02 01:47:03 millert Exp $"; #endif /* not lint */ /* @@ -136,7 +136,7 @@ main(argc, argv) for (p = system; *p; p++) *p = '\0'; PN = PNbuf; - (void)sprintf(sbuf, "tip%d", BR); + (void)snprintf(sbuf, sizeof(sbuf), "tip%d", BR); system = sbuf; notnumber: @@ -361,7 +361,7 @@ tipin() if (!(gch = escape())) continue; } else if (!cumode && gch == character(value(RAISECHAR))) { - boolean(value(RAISE)) = !boolean(value(RAISE)); + setboolean(value(RAISE), !boolean(value(RAISE))); continue; } else if (gch == '\r') { bol = 1; @@ -575,7 +575,7 @@ setparity(defparity) { register int i, flip, clr, set; char *parity; - extern char evenpartab[]; + extern const unsigned char evenpartab[]; if (value(PARITY) == NOSTR) value(PARITY) = defparity; diff --git a/usr.bin/tip/tip.h b/usr.bin/tip/tip.h index f2425a95812..86d0e4a913c 100644 --- a/usr.bin/tip/tip.h +++ b/usr.bin/tip/tip.h @@ -1,5 +1,5 @@ -/* $OpenBSD: tip.h,v 1.4 1996/10/15 23:47:22 millert Exp $ */ -/* $NetBSD: tip.h,v 1.4 1995/10/29 00:49:43 pk Exp $ */ +/* $OpenBSD: tip.h,v 1.5 1997/04/02 01:47:03 millert Exp $ */ +/* $NetBSD: tip.h,v 1.5 1996/12/29 10:34:11 cgd Exp $ */ /* * Copyright (c) 1989, 1993 @@ -144,30 +144,18 @@ typedef * initialize it in vars.c, so we cast it as needed to keep lint * happy. */ -typedef - union { - int zz_number; - short zz_boolean[2]; - char zz_character[4]; - int *zz_address; - } - zzhack; #define value(v) vtable[v].v_value -#define number(v) ((((zzhack *)(&(v))))->zz_number) - -#if BYTE_ORDER == LITTLE_ENDIAN -#define boolean(v) ((((zzhack *)(&(v))))->zz_boolean[0]) -#define character(v) ((((zzhack *)(&(v))))->zz_character[0]) -#endif - -#if BYTE_ORDER == BIG_ENDIAN -#define boolean(v) ((((zzhack *)(&(v))))->zz_boolean[1]) -#define character(v) ((((zzhack *)(&(v))))->zz_character[3]) -#endif +#define number(v) ((long)(v)) +#define boolean(v) ((short)(long)(v)) +#define character(v) ((char)(long)(v)) +#define address(v) ((long *)(v)) -#define address(v) ((((zzhack *)(&(v))))->zz_address) +#define setnumber(v,n) do { (v) = (char *)(long)(n); } while (0) +#define setboolean(v,n) do { (v) = (char *)(long)(n); } while (0) +#define setcharacter(v,n) do { (v) = (char *)(long)(n); } while (0) +#define setaddress(v,n) do { (v) = (char *)(n); } while (0) /* * Escape command table definitions -- diff --git a/usr.bin/tip/tipout.c b/usr.bin/tip/tipout.c index c92c61ef585..40d3268635f 100644 --- a/usr.bin/tip/tipout.c +++ b/usr.bin/tip/tipout.c @@ -1,5 +1,5 @@ -/* $OpenBSD: tipout.c,v 1.3 1996/06/26 05:40:48 deraadt Exp $ */ -/* $NetBSD: tipout.c,v 1.4 1995/10/29 00:49:45 pk Exp $ */ +/* $OpenBSD: tipout.c,v 1.4 1997/04/02 01:47:04 millert Exp $ */ +/* $NetBSD: tipout.c,v 1.5 1996/12/29 10:34:12 cgd Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)tipout.c 8.1 (Berkeley) 6/6/93"; #endif -static char rcsid[] = "$OpenBSD: tipout.c,v 1.3 1996/06/26 05:40:48 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: tipout.c,v 1.4 1997/04/02 01:47:04 millert Exp $"; #endif /* not lint */ #include "tip.h" @@ -84,14 +84,14 @@ intEMT() if (boolean(value(SCRIPT)) && fscript != NULL) fclose(fscript); if (pline == line) { - boolean(value(SCRIPT)) = FALSE; + setboolean(value(SCRIPT), FALSE); reply = 'y'; } else { if ((fscript = fopen(line, "a")) == NULL) reply = 'n'; else { reply = 'y'; - boolean(value(SCRIPT)) = TRUE; + setboolean(value(SCRIPT), TRUE); } } write(repdes[1], &reply, 1); @@ -111,7 +111,7 @@ void intSYS() { - boolean(value(BEAUTIFY)) = !boolean(value(BEAUTIFY)); + setboolean(value(BEAUTIFY), !boolean(value(BEAUTIFY))); longjmp(sigbuf, 1); } diff --git a/usr.bin/tip/uucplock.c b/usr.bin/tip/uucplock.c index 07724655575..00f8629921e 100644 --- a/usr.bin/tip/uucplock.c +++ b/usr.bin/tip/uucplock.c @@ -1,5 +1,5 @@ -/* $OpenBSD: uucplock.c,v 1.2 1996/06/26 05:40:49 deraadt Exp $ */ -/* $NetBSD: uucplock.c,v 1.6 1995/09/26 06:02:14 jtc Exp $ */ +/* $OpenBSD: uucplock.c,v 1.3 1997/04/02 01:47:04 millert Exp $ */ +/* $NetBSD: uucplock.c,v 1.7 1997/02/11 09:24:08 mrg Exp $ */ /* * Copyright (c) 1988, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)uucplock.c 8.1 (Berkeley) 6/6/93"; #endif -static char rcsid[] = "$OpenBSD: uucplock.c,v 1.2 1996/06/26 05:40:49 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: uucplock.c,v 1.3 1997/04/02 01:47:04 millert Exp $"; #endif /* not lint */ #include <stdio.h> @@ -106,7 +106,7 @@ uu_lock(ttyname) /* fall out and finish the locking process */ } pid = getpid(); - sprintf(text_pid, "%10d\n", pid); + (void)sprintf(text_pid, "%10d\n", pid); len = strlen(text_pid); if (write(fd, text_pid, len) != len) { (void)close(fd); diff --git a/usr.bin/tip/value.c b/usr.bin/tip/value.c index 69063eb8f47..dd6b3872232 100644 --- a/usr.bin/tip/value.c +++ b/usr.bin/tip/value.c @@ -1,5 +1,5 @@ -/* $OpenBSD: value.c,v 1.3 1996/10/15 23:47:22 millert Exp $ */ -/* $NetBSD: value.c,v 1.3 1994/12/08 09:31:17 jtc Exp $ */ +/* $OpenBSD: value.c,v 1.4 1997/04/02 01:47:04 millert Exp $ */ +/* $NetBSD: value.c,v 1.6 1997/02/11 09:24:09 mrg Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)value.c 8.1 (Berkeley) 6/6/93"; #endif -static char rcsid[] = "$OpenBSD: value.c,v 1.3 1996/10/15 23:47:22 millert Exp $"; +static char rcsid[] = "$OpenBSD: value.c,v 1.4 1997/04/02 01:47:04 millert Exp $"; #endif /* not lint */ #include "tip.h" @@ -63,14 +63,14 @@ vinit() if (cp = getenv(p->v_name)) p->v_value = cp; if (p->v_type&IREMOTE) - number(p->v_value) = *address(p->v_value); + setnumber(p->v_value, *address(p->v_value)); } /* * Read the .tiprc file in the HOME directory * for sets */ if (strlen(value(HOME)) + sizeof("/.tiprc") > sizeof(file)) { - fprintf(stderr, "Home directory path too long: %s\n", + (void)fprintf(stderr, "Home directory path too long: %s\n", value(HOME)); } else { strcpy(file, value(HOME)); @@ -113,41 +113,40 @@ vassign(p, v) return; if (!(p->v_type&(ENVIRON|INIT))) free(p->v_value); - if ((p->v_value = malloc(size(v)+1)) == NOSTR) { + if ((p->v_value = strdup(v)) == NOSTR) { printf("out of core\r\n"); return; } p->v_type &= ~(ENVIRON|INIT); - strcpy(p->v_value, v); break; case NUMBER: if (number(p->v_value) == number(v)) return; - number(p->v_value) = number(v); + setnumber(p->v_value, number(v)); break; case BOOL: if (boolean(p->v_value) == (*v != '!')) return; - boolean(p->v_value) = (*v != '!'); + setboolean(p->v_value, (*v != '!')); break; case CHAR: if (character(p->v_value) == *v) return; - character(p->v_value) = *v; + setcharacter(p->v_value, *v); } p->v_access |= CHANGED; } static void vprint(); +static void vtoken(); vlex(s) register char *s; { register value_t *p; - static void vtoken(); if (equal(s, "all")) { for (p = vtable; p->v_name; p++) |