From 745600d863acd50f4b0c8343f20f84b5ea62f348 Mon Sep 17 00:00:00 2001 From: lukem Date: Fri, 17 Oct 1997 13:36:36 +0000 Subject: [PATCH] WARNSify --- usr.sbin/sliplogin/Makefile | 3 +-- usr.sbin/sliplogin/sliplogin.8 | 18 +++++++++--------- usr.sbin/sliplogin/sliplogin.c | 28 +++++++++++++++++----------- usr.sbin/slstats/slstats.8 | 10 +++++----- usr.sbin/slstats/slstats.c | 28 ++++++++++++++++------------ usr.sbin/spray/spray.8 | 10 +++++----- usr.sbin/spray/spray.c | 12 +++++++++--- 7 files changed, 62 insertions(+), 47 deletions(-) diff --git a/usr.sbin/sliplogin/Makefile b/usr.sbin/sliplogin/Makefile index 26888b6211bd..81034e22bee4 100644 --- a/usr.sbin/sliplogin/Makefile +++ b/usr.sbin/sliplogin/Makefile @@ -1,10 +1,9 @@ -# $NetBSD: Makefile,v 1.4 1997/10/17 08:49:29 mrg Exp $ +# $NetBSD: Makefile,v 1.5 1997/10/17 13:36:36 lukem Exp $ # from: @(#)Makefile 8.1 (Berkeley) 7/19/93 PROG= sliplogin MAN= sliplogin.8 BINOWN= root BINMODE=4555 -#INSTALLFLAGS=-fschg .include diff --git a/usr.sbin/sliplogin/sliplogin.8 b/usr.sbin/sliplogin/sliplogin.8 index d15dc5c704b8..42d53bb4f14c 100644 --- a/usr.sbin/sliplogin/sliplogin.8 +++ b/usr.sbin/sliplogin/sliplogin.8 @@ -1,4 +1,4 @@ -.\" $NetBSD: sliplogin.8,v 1.5 1997/10/17 08:49:50 mrg Exp $ +.\" $NetBSD: sliplogin.8,v 1.6 1997/10/17 13:36:47 lukem Exp $ .\" .\" Copyright (c) 1990, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -40,10 +40,10 @@ .Nm sliplogin .Nd attach a serial line network interface .Sh SYNOPSIS -.Nm sliplogin +.Nm .Op Ar loginname .Sh DESCRIPTION -.Nm Sliplogin +.Nm is used to turn the terminal line on standard input into a Serial Line IP .Pq Tn SLIP @@ -86,7 +86,7 @@ entry, in order starting with .Pp Only the super-user may attach a network interface. The interface is automatically detached when the other end hangs up or the -.Nm sliplogin +.Nm process dies. If the kernel slip module has been configured for it, all routes through that interface will also disappear at the same time. If there is other processing a site @@ -122,15 +122,15 @@ slip line and is the appropriate IP netmask. These arguments are passed directly to .Xr ifconfig 8 . -.Em Opt-args +.Em opt-args are optional arguments used to configure the line. .Sh EXAMPLE The normal use of -.Nm sliplogin +.Nm is to create a .Pa /etc/passwd entry for each legal, remote slip site with -.Nm sliplogin +.Nm as the shell for that entry. E.g., .Bd -literal Sfoo:ikhuy6:2010:1:slip line to foo:/tmp:/usr/sbin/sliplogin @@ -157,7 +157,7 @@ to the local host name and is the local host IP netmask. .Pp Note that -.Nm sliplogin +.Nm must be setuid to root and, while not a security hole, moral defectives can use it to place terminal lines in an unusable state and/or deny access to legitimate users of a remote slip line. To prevent this, @@ -171,7 +171,7 @@ and mode 4550 (setuid root, only group .Em slip can execute binary). .Sh DIAGNOSTICS -.Nm Sliplogin +.Nm logs various information to the system log daemon, .Xr syslogd 8 , with a facility code of diff --git a/usr.sbin/sliplogin/sliplogin.c b/usr.sbin/sliplogin/sliplogin.c index 6a80fdb360f7..1cfd9112e4db 100644 --- a/usr.sbin/sliplogin/sliplogin.c +++ b/usr.sbin/sliplogin/sliplogin.c @@ -1,4 +1,4 @@ -/* $NetBSD: sliplogin.c,v 1.13 1997/10/17 08:49:55 mrg Exp $ */ +/* $NetBSD: sliplogin.c,v 1.14 1997/10/17 13:36:53 lukem Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -33,17 +33,17 @@ * SUCH DAMAGE. */ +#include #ifndef lint -static char copyright[] = -"@(#) Copyright (c) 1990, 1993\n\ - The Regents of the University of California. All rights reserved.\n"; +__COPYRIGHT("@(#) Copyright (c) 1990, 1993\n\ + The Regents of the University of California. All rights reserved.\n"); #endif /* not lint */ #ifndef lint #if 0 static char sccsid[] = "@(#)sliplogin.c 8.2 (Berkeley) 2/1/94"; #else -static char rcsid[] = "$Id: sliplogin.c,v 1.13 1997/10/17 08:49:55 mrg Exp $"; +__RCSID("$NetBSD: sliplogin.c,v 1.14 1997/10/17 13:36:53 lukem Exp $"); #endif #endif /* not lint */ @@ -73,12 +73,15 @@ static char rcsid[] = "$Id: sliplogin.c,v 1.13 1997/10/17 08:49:55 mrg Exp $"; * /etc/slip.hosts file and if found fd0 is configured as in case 1. */ +#include +#include #include #include -#include +#include #include #include #include +#include #if BSD >= 199006 #define POSIX @@ -107,6 +110,11 @@ char loginargs[BUFSIZ]; char loginfile[MAXPATHLEN]; char loginname[BUFSIZ]; +void findid __P((char *)); +void hup_handler __P((int)); +int main __P((int, char **)); +const char *sigstr __P((int)); + void findid(name) char *name; @@ -117,7 +125,7 @@ findid(name) static char raddr[16]; static char mask[16]; char user[16]; - int i, j, n; + int n; (void)strncpy(loginname, name, sizeof(loginname) - 1); if ((fp = fopen(_PATH_ACCESS, "r")) == NULL) { @@ -201,6 +209,7 @@ hup_handler(s) /* NOTREACHED */ } +int main(argc, argv) int argc; char *argv[]; @@ -213,7 +222,6 @@ main(argc, argv) struct sgttyb tty, otty; #endif char logincmd[2*BUFSIZ+32]; - extern uid_t getuid(); if ((name = strrchr(argv[0], '/')) == NULL) name = argv[0]; @@ -261,8 +269,6 @@ main(argc, argv) perror("ioctl (TIOCSCTTY)"); #endif } else { - extern char *getlogin(); - if ((name = getlogin()) == NULL) { syslog(LOG_ERR, "access denied - getlogin returned 0\n"); @@ -346,7 +352,7 @@ main(argc, argv) * to see whether changes are allowed (or just "route get"). */ (void) setuid(0); - if (s = system(logincmd)) { + if ((s = system(logincmd)) != NULL) { syslog(LOG_ERR, "%s login failed: exit status %d from %s", loginname, s, loginfile); (void) ioctl(STDIN_FILENO, TIOCSETD, (caddr_t)&odisc); diff --git a/usr.sbin/slstats/slstats.8 b/usr.sbin/slstats/slstats.8 index 1686990ef044..8bcb5550ed4d 100644 --- a/usr.sbin/slstats/slstats.8 +++ b/usr.sbin/slstats/slstats.8 @@ -1,4 +1,4 @@ -.\" $NetBSD: slstats.8,v 1.5 1997/08/27 07:59:19 mikel Exp $ +.\" $NetBSD: slstats.8,v 1.6 1997/10/17 13:38:00 lukem Exp $ .\" .Dd July 5, 1993 .Dt SLSTATS 8 @@ -6,7 +6,7 @@ .Nm slstats .Nd report slip statistics .Sh SYNOPSIS -.Nm slstats +.Nm .Op Fl M Ar core .Op Fl N Ar system .Op Fl v @@ -15,14 +15,14 @@ .Sh DESCRIPTION .Pp The -.Nm slstats +.Nm utility reports slip-related statistics for the -.Nm sl Ns +.Ic sl Ns .So .Ar unit-number .Sc interface. If the -.Nm unit-number +.Ar unit-number is unspecified, it defaults to 0. These statistics are displayed at regular intervals. .Pp diff --git a/usr.sbin/slstats/slstats.c b/usr.sbin/slstats/slstats.c index 85491751d9ee..b758882cc4ef 100644 --- a/usr.sbin/slstats/slstats.c +++ b/usr.sbin/slstats/slstats.c @@ -1,4 +1,4 @@ -/* $NetBSD: slstats.c,v 1.8 1996/12/08 13:54:42 mycroft Exp $ */ +/* $NetBSD: slstats.c,v 1.9 1997/10/17 13:38:08 lukem Exp $ */ /* * print serial line IP statistics: @@ -23,8 +23,9 @@ * - Initial distribution. */ +#include #ifndef lint -static char rcsid[] = "$NetBSD: slstats.c,v 1.8 1996/12/08 13:54:42 mycroft Exp $"; +__RCSID("$NetBSD: slstats.c,v 1.9 1997/10/17 13:38:08 lukem Exp $"); #endif #define INET @@ -50,17 +51,18 @@ static char rcsid[] = "$NetBSD: slstats.c,v 1.8 1996/12/08 13:54:42 mycroft Exp #include #include #include +#include +#include #include #include #include -#include -#include +#include #include struct nlist nl[] = { #define N_SOFTC 0 { "_sl_softc" }, - "", + { "" }, }; extern char *__progname; /* from crt0.o */ @@ -74,8 +76,9 @@ int vflag; unsigned interval = 5; int unit; -void catchalarm __P((void)); +void catchalarm __P((int)); void intpr __P((void)); +int main __P((int, char **)); void usage __P((void)); int @@ -184,7 +187,7 @@ intpr() if (kvm_read(kd, addr, (char *)sc, AMT) != AMT) errx(1, "kvm_read: %s", kvm_geterr(kd)); - (void)signal(SIGALRM, (void (*)())catchalarm); + (void)signal(SIGALRM, catchalarm); signalled = 0; (void)alarm(interval); @@ -199,20 +202,20 @@ intpr() printf(" %6.6s %6.6s", "SEARCH", "MISS"); putchar('\n'); } - printf("%8u %6d %6u %6u %6u", + printf("%8lu %6ld %6u %6u %6u", V(sc_if.if_ibytes), - V(sc_if.if_ipackets), + (long)V(sc_if.if_ipackets), V(sc_comp.sls_compressedin), V(sc_comp.sls_uncompressedin), V(sc_comp.sls_errorin)); if (vflag) - printf(" %6u %6u", + printf(" %6u %6lu", V(sc_comp.sls_tossed), V(sc_if.if_ipackets) - V(sc_comp.sls_compressedin) - V(sc_comp.sls_uncompressedin) - V(sc_comp.sls_errorin)); - printf(" | %8u %6d %6u %6u %6u", + printf(" | %8lu %6ld %6u %6u %6lu", V(sc_if.if_obytes), V(sc_if.if_opackets), V(sc_comp.sls_compressed), @@ -242,7 +245,8 @@ intpr() * Sets a flag to not wait for the alarm. */ void -catchalarm() +catchalarm(dummy) + int dummy; { signalled = 1; } diff --git a/usr.sbin/spray/spray.8 b/usr.sbin/spray/spray.8 index 9433ae01187c..b5dfd16d0d4a 100644 --- a/usr.sbin/spray/spray.8 +++ b/usr.sbin/spray/spray.8 @@ -1,4 +1,4 @@ -.\" $NetBSD: spray.8,v 1.2 1996/08/30 20:12:18 thorpej Exp $ +.\" $NetBSD: spray.8,v 1.3 1997/10/17 13:39:03 lukem Exp $ .\" .\" Copyright (c) 1994 James A. Jegers .\" All rights reserved. @@ -29,7 +29,7 @@ .Nm spray .Nd send many packets to host .Sh SYNOPSIS -.Nm spray +.Nm .Op Fl c Ar count .Op Fl d Ar delay .Op Fl l Ar length @@ -37,7 +37,7 @@ \&... .Ek .Sh DESCRIPTION -.Nm Spray +.Nm sends multiple RPC packets to .Ar host and records how many of them were correctly received and how long it took. @@ -59,11 +59,11 @@ bytes. Not all values of .Ar length are possible because RPC data is encoded using XDR. -.Nm Spray +.Nm rounds up to the nearest possible value. .El .Pp -.Nm Spray +.Nm is intended for use in network testing, measurement, and management. This command .Bf -emphasis diff --git a/usr.sbin/spray/spray.c b/usr.sbin/spray/spray.c index 99f21b35ad78..7e2d187e13e4 100644 --- a/usr.sbin/spray/spray.c +++ b/usr.sbin/spray/spray.c @@ -1,4 +1,4 @@ -/* $NetBSD: spray.c,v 1.4 1996/08/30 20:12:20 thorpej Exp $ */ +/* $NetBSD: spray.c,v 1.5 1997/10/17 13:39:12 lukem Exp $ */ /* * Copyright (c) 1993 Winning Strategies, Inc. @@ -30,6 +30,11 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include +#ifndef lint +__RCSID("$NetBSD: spray.c,v 1.5 1997/10/17 13:39:12 lukem Exp $"); +#endif + #include #include #include @@ -41,8 +46,9 @@ #define SPRAYOVERHEAD 86 #endif -void usage (); -void print_xferstats (); +int main __P((int, char **)); +void print_xferstats __P((int, int, double)); +void usage __P((void)); /* spray buffer */ char spray_buffer[SPRAYMAX];