From 166448c2dcfc476c5cc8abd60e5686244ffe8adb Mon Sep 17 00:00:00 2001 From: lukem Date: Fri, 17 Oct 1997 13:02:01 +0000 Subject: [PATCH] WARNSify --- usr.sbin/repquota/repquota.8 | 8 ++--- usr.sbin/repquota/repquota.c | 67 +++++++++++++++++++++--------------- usr.sbin/rmt/rmt.8 | 16 ++++----- usr.sbin/rmt/rmt.c | 11 +++--- 4 files changed, 58 insertions(+), 44 deletions(-) diff --git a/usr.sbin/repquota/repquota.8 b/usr.sbin/repquota/repquota.8 index 035c64dd4808..610a1f5d2293 100644 --- a/usr.sbin/repquota/repquota.8 +++ b/usr.sbin/repquota/repquota.8 @@ -33,7 +33,7 @@ .\" SUCH DAMAGE. .\" .\" from: @(#)repquota.8 8.1 (Berkeley) 6/6/93 -.\" $Id: repquota.8,v 1.3 1994/06/13 22:07:25 mycroft Exp $ +.\" $Id: repquota.8,v 1.4 1997/10/17 13:02:01 lukem Exp $ .\" .Dd June 6, 1993 .Dt REPQUOTA 8 @@ -42,18 +42,18 @@ .Nm repquota .Nd summarize quotas for a file system .Sh SYNOPSIS -.Nm repquota +.Nm .Op Fl g .Op Fl u .Op Fl v .Ar filesystem Ar ... -.Nm repquota +.Nm "" .Op Fl g .Op Fl u .Op Fl v .Fl a .Sh DESCRIPTION -.Nm Repquota +.Nm prints a summary of the disk usage and quotas for the specified file systems. .Pp diff --git a/usr.sbin/repquota/repquota.c b/usr.sbin/repquota/repquota.c index 852a29027f96..8f451e34c9db 100644 --- a/usr.sbin/repquota/repquota.c +++ b/usr.sbin/repquota/repquota.c @@ -44,7 +44,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1990, 1993\n\ #if 0 static char sccsid[] = "@(#)repquota.c 8.2 (Berkeley) 11/22/94"; #else -__RCSID("$NetBSD: repquota.c,v 1.10 1997/10/17 07:35:05 mrg Exp $"); +__RCSID("$NetBSD: repquota.c,v 1.11 1997/10/17 13:02:09 lukem Exp $"); #endif #endif /* not lint */ @@ -55,12 +55,14 @@ __RCSID("$NetBSD: repquota.c,v 1.10 1997/10/17 07:35:05 mrg Exp $"); #include #include #include -#include -#include -#include -#include -#include #include +#include +#include +#include +#include +#include +#include +#include char *qfname = QUOTAFILENAME; char *qfextension[] = INITQFNAMES; @@ -74,20 +76,28 @@ struct fileusage { }; #define FUHASH 1024 /* must be power of two */ struct fileusage *fuhead[MAXQUOTAS][FUHASH]; -struct fileusage *lookup(); -struct fileusage *addid(); u_long highid[MAXQUOTAS]; /* highest addid()'ed identifier per type */ int vflag; /* verbose */ int aflag; /* all file systems */ +struct fileusage *addid __P((u_long, int, char *)); +int hasquota __P((struct fstab *, int, char **)); +struct fileusage *lookup __P((u_long, int)); +int main __P((int, char **)); +int oneof __P((char *, char **, int)); +int repquota __P((struct fstab *, int, char *)); +char *timeprt __P((time_t)); +void usage __P((void)); + +int main(argc, argv) int argc; char **argv; { - register struct fstab *fs; - register struct passwd *pw; - register struct group *gr; + struct fstab *fs; + struct passwd *pw; + struct group *gr; int gflag = 0, uflag = 0, errs = 0; long i, argnum, done = 0; extern char *optarg; @@ -161,6 +171,7 @@ main(argc, argv) exit(errs); } +void usage() { fprintf(stderr, "Usage:\n\t%s\n\t%s\n", @@ -169,16 +180,16 @@ usage() exit(1); } +int repquota(fs, type, qfpathname) - register struct fstab *fs; + struct fstab *fs; int type; char *qfpathname; { - register struct fileusage *fup; + struct fileusage *fup; FILE *qf; u_long id; struct dqblk dqbuf; - char *timeprt(); static struct dqblk zerodqblk; static int warned = 0; static int multiple = 0; @@ -250,11 +261,12 @@ repquota(fs, type, qfpathname) /* * Check to see if target appears in list of size cnt. */ +int oneof(target, list, cnt) - register char *target, *list[]; + char *target, *list[]; int cnt; { - register int i; + int i; for (i = 0; i < cnt; i++) if (strcmp(target, list[i]) == 0) @@ -265,13 +277,14 @@ oneof(target, list, cnt) /* * Check to see if a particular quota is to be enabled. */ +int hasquota(fs, type, qfnamep) - register struct fstab *fs; + struct fstab *fs; int type; char **qfnamep; { - register char *opt; - char *cp, *index(), *strtok(); + char *opt; + char *cp; static char initname, usrname[100], grpname[100]; static char buf[BUFSIZ]; @@ -282,7 +295,7 @@ hasquota(fs, type, qfnamep) } strcpy(buf, fs->fs_mntops); for (opt = strtok(buf, ","); opt; opt = strtok(NULL, ",")) { - if (cp = index(opt, '=')) + if ((cp = strchr(opt, '=')) != NULL) *cp++ = '\0'; if (type == USRQUOTA && strcmp(opt, usrname) == 0) break; @@ -310,7 +323,7 @@ lookup(id, type) u_long id; int type; { - register struct fileusage *fup; + struct fileusage *fup; for (fup = fuhead[type][id & (FUHASH-1)]; fup != 0; fup = fup->fu_next) if (fup->fu_id == id) @@ -329,9 +342,8 @@ addid(id, type, name) { struct fileusage *fup, **fhp; int len; - extern char *calloc(); - if (fup = lookup(id, type)) + if ((fup = lookup(id, type)) != NULL) return (fup); if (name) len = strlen(name); @@ -350,7 +362,7 @@ addid(id, type, name) if (name) { bcopy(name, fup->fu_name, len + 1); } else { - sprintf(fup->fu_name, "%u", id); + sprintf(fup->fu_name, "%lu", (u_long)id); } return (fup); } @@ -374,13 +386,14 @@ timeprt(seconds) minutes = (seconds + 30) / 60; hours = (minutes + 30) / 60; if (hours >= 36) { - sprintf(buf, "%ddays", (hours + 12) / 24); + sprintf(buf, "%lddays", (long)((hours + 12) / 24)); return (buf); } if (minutes >= 60) { - sprintf(buf, "%2d:%d", minutes / 60, minutes % 60); + sprintf(buf, "%2ld:%ld", (long)(minutes / 60), + (long)(minutes % 60)); return (buf); } - sprintf(buf, "%2d", minutes); + sprintf(buf, "%2ld", (long)minutes); return (buf); } diff --git a/usr.sbin/rmt/rmt.8 b/usr.sbin/rmt/rmt.8 index ba29c5a0d4af..77a907408b88 100644 --- a/usr.sbin/rmt/rmt.8 +++ b/usr.sbin/rmt/rmt.8 @@ -1,4 +1,4 @@ -.\" $NetBSD: rmt.8,v 1.5 1997/10/17 08:05:24 mrg Exp $ +.\" $NetBSD: rmt.8,v 1.6 1997/10/17 13:03:15 lukem Exp $ .\" .\" Copyright (c) 1983, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -40,13 +40,13 @@ .Nm rmt .Nd remote magtape protocol module .Sh SYNOPSIS -.Nm rmt +.Nm .Sh DESCRIPTION -.Nm Rmt +.Nm is a program used by the remote dump and restore programs in manipulating a magnetic tape drive through an interprocess communication connection. -.Nm Rmt +.Nm is normally started up with an .Xr rexec 3 or @@ -54,7 +54,7 @@ or call. .Pp The -.Nm rmt +.Nm program accepts requests specific to the manipulation of magnetic tapes, performs the commands, then responds with a status indication. All responses are in @@ -135,7 +135,7 @@ call. .It Sy W Ar count No \en .Sm on Write data onto the open device. -.Nm Rmt +.Nm reads .Ar count bytes from the connection, aborting if @@ -154,7 +154,7 @@ If .Ar count exceeds the size of the data buffer (10 kilobytes), it is truncated to the data buffer size. -.Nm rmt +.Nm then performs the requested .Xr read 2 and responds with @@ -200,7 +200,7 @@ sent (in binary). .Sm on .Pp Any other command causes -.Nm rmt +.Nm to exit. .Sh DIAGNOSTICS All responses are of the form described above. diff --git a/usr.sbin/rmt/rmt.c b/usr.sbin/rmt/rmt.c index f1f3d845dce1..bfb4d37e0c2d 100644 --- a/usr.sbin/rmt/rmt.c +++ b/usr.sbin/rmt/rmt.c @@ -1,4 +1,4 @@ -/* $NetBSD: rmt.c,v 1.8 1997/10/17 08:05:30 mrg Exp $ */ +/* $NetBSD: rmt.c,v 1.9 1997/10/17 13:03:25 lukem Exp $ */ /* * Copyright (c) 1983, 1993 @@ -33,17 +33,17 @@ * SUCH DAMAGE. */ +#include #ifndef lint -static char copyright[] = -"@(#) Copyright (c) 1983, 1993\n\ - The Regents of the University of California. All rights reserved.\n"; +__COPYRIGHT("@(#) Copyright (c) 1983, 1993\n\ + The Regents of the University of California. All rights reserved.\n"); #endif /* not lint */ #ifndef lint #if 0 static char sccsid[] = "@(#)rmt.c 8.1 (Berkeley) 6/6/93"; #else -static char rcsid[] = "$NetBSD: rmt.c,v 1.8 1997/10/17 08:05:30 mrg Exp $"; +__RCSID("$NetBSD: rmt.c,v 1.9 1997/10/17 13:03:25 lukem Exp $"); #endif #endif /* not lint */ @@ -81,6 +81,7 @@ FILE *debug; char *checkbuf __P((char *, int)); void error __P((int)); +int main __P((int, char **)); void getstring __P((char *)); int