summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2001-12-01 19:00:35 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2001-12-01 19:00:35 +0000
commit94936f6695a8dda9c4f88c07f821a8cd65b6be1f (patch)
treeb192be3fb603022149e8b2756cd4809e523b73d0
parent59853950a77c6b085e98233b2f25aa9bfff1a4b6 (diff)
KNF
-rw-r--r--usr.bin/fstat/fstat.c41
-rw-r--r--usr.bin/fstat/isofs.c3
-rw-r--r--usr.bin/quota/quota.c57
3 files changed, 51 insertions, 50 deletions
diff --git a/usr.bin/fstat/fstat.c b/usr.bin/fstat/fstat.c
index 2b449f51f53..a7bb92c7aef 100644
--- a/usr.bin/fstat/fstat.c
+++ b/usr.bin/fstat/fstat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fstat.c,v 1.33 2001/11/26 01:37:16 itojun Exp $ */
+/* $OpenBSD: fstat.c,v 1.34 2001/12/01 18:59:59 deraadt Exp $ */
/*-
* Copyright (c) 1988, 1993
@@ -41,7 +41,7 @@ static char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)fstat.c 8.1 (Berkeley) 6/6/93";*/
-static char *rcsid = "$OpenBSD: fstat.c,v 1.33 2001/11/26 01:37:16 itojun Exp $";
+static char *rcsid = "$OpenBSD: fstat.c,v 1.34 2001/12/01 18:59:59 deraadt Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -138,7 +138,7 @@ int maxfiles;
}
/*
- * a kvm_read that returns true if everything is read
+ * a kvm_read that returns true if everything is read
*/
#define KVM_READ(kaddr, paddr, len) \
(kvm_read(kd, (u_long)(kaddr), (void *)(paddr), (len)) == (len))
@@ -232,7 +232,7 @@ main(argc, argv)
ALLOC_OFILES(256); /* reserve space for file pointers */
- if (fsflg && !checkfile) {
+ if (fsflg && !checkfile) {
/* -f with no files means use wd */
if (getfname(".") == 0)
exit(1);
@@ -280,7 +280,8 @@ main(argc, argv)
char *Uname, *Comm;
pid_t Pid;
-#define PREFIX(i) printf("%-8.8s %-10s %5d", Uname, Comm, Pid); \
+#define PREFIX(i) do { \
+ printf("%-8.8s %-10s %5d", Uname, Comm, Pid); \
switch(i) { \
case TEXT: \
printf(" text"); \
@@ -297,7 +298,8 @@ pid_t Pid;
default: \
printf(" %4d", i); \
break; \
- }
+ } \
+} while (0)
/*
* print open files attributed to this process
@@ -432,10 +434,11 @@ vtrans(vp, i, flag, offset)
case VT_NULL:
if (!null_filestat(&vn, &fst))
badtype = "error";
- break;
+ break;
default: {
static char unknown[30];
- sprintf(badtype = unknown, "?(%x)", vn.v_tag);
+ snprintf(badtype = unknown, sizeof unknown,
+ "?(%x)", vn.v_tag);
break;
}
}
@@ -467,22 +470,22 @@ vtrans(vp, i, flag, offset)
else
(void)printf(" %-8s", getmnton(vn.v_mount));
if (nflg)
- (void)sprintf(mode, "%o", fst.mode);
+ (void)snprintf(mode, sizeof mode, "%o", fst.mode);
else
strmode(fst.mode, mode);
(void)printf(" %6ld %11s", fst.fileid, mode);
rw[0] = '\0';
if (flag & FREAD)
- strcat(rw, "r");
+ strlcat(rw, "r", sizeof rw);
if (flag & FWRITE)
- strcat(rw, "w");
+ strlcat(rw, "w", sizeof rw);
printf(" %2s", rw);
switch (vn.v_type) {
case VBLK:
case VCHR: {
char *name;
- if (nflg || ((name = devname(fst.rdev, vn.v_type == VCHR ?
+ if (nflg || ((name = devname(fst.rdev, vn.v_type == VCHR ?
S_IFCHR : S_IFBLK)) == NULL))
printf(" %2d,%-3d", major(fst.rdev), minor(fst.rdev));
else
@@ -604,7 +607,7 @@ nfs_filestat(vp, fsp)
break;
default:
break;
- };
+ }
fsp->mode = mode;
return 1;
@@ -698,7 +701,7 @@ null_filestat(vp, fsp)
if (fail)
fsp->fileid = (long)node.null_lowervp;
else
- fsp->fileid = fst.fileid;
+ fsp->fileid = fst.fileid;
fsp->mode = fst.mode;
fsp->size = fst.mode;
fsp->rdev = fst.mode;
@@ -761,10 +764,10 @@ pipetrans(pipe, i)
maxaddr = MAX(pipe, pi.pipe_peer);
printf("pipe %p state: %s%s%s", maxaddr,
- (pi.pipe_state & PIPE_WANTR) ? "R" : "",
- (pi.pipe_state & PIPE_WANTW) ? "W" : "",
- (pi.pipe_state & PIPE_EOF) ? "E" : "");
-
+ (pi.pipe_state & PIPE_WANTR) ? "R" : "",
+ (pi.pipe_state & PIPE_WANTW) ? "W" : "",
+ (pi.pipe_state & PIPE_EOF) ? "E" : "");
+
printf("\n");
return;
bad:
@@ -861,7 +864,7 @@ socktrans(sock, i)
else
printf("* %s %s", dname, stypename[so.so_type]);
- /*
+ /*
* protocol specific formatting
*
* Try to find interesting things to print. For tcp, the interesting
diff --git a/usr.bin/fstat/isofs.c b/usr.bin/fstat/isofs.c
index 23f235df1db..67566353d0b 100644
--- a/usr.bin/fstat/isofs.c
+++ b/usr.bin/fstat/isofs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: isofs.c,v 1.2 1998/07/09 20:28:02 mickey Exp $ */
+/* $OpenBSD: isofs.c,v 1.3 2001/12/01 18:59:59 deraadt Exp $ */
/*-
* Copyright (c) 1988, 1993
@@ -93,6 +93,5 @@ isofs_filestat(vp, fsp)
fsp->mode = inode.inode.iso_mode;
fsp->size = inode.i_size;
fsp->rdev = inode.i_dev;
-
return 1;
}
diff --git a/usr.bin/quota/quota.c b/usr.bin/quota/quota.c
index dff0a239c5a..455a410bb33 100644
--- a/usr.bin/quota/quota.c
+++ b/usr.bin/quota/quota.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: quota.c,v 1.16 2000/10/18 23:05:16 pjanzen Exp $ */
+/* $OpenBSD: quota.c,v 1.17 2001/12/01 19:00:34 deraadt Exp $ */
/*
* Copyright (c) 1980, 1990, 1993
@@ -44,7 +44,7 @@ static char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)quota.c 8.1 (Berkeley) 6/6/93";*/
-static char rcsid[] = "$OpenBSD: quota.c,v 1.16 2000/10/18 23:05:16 pjanzen Exp $";
+static char rcsid[] = "$OpenBSD: quota.c,v 1.17 2001/12/01 19:00:34 deraadt Exp $";
#endif /* not lint */
/*
@@ -370,23 +370,23 @@ showquotas(type, id, name)
printf("%s\n", qup->fsname);
nam = "";
}
- printf("%15s%8d%c%7d%8d%8s"
- , nam
- , (int)(dbtob((u_quad_t)qup->dqblk.dqb_curblocks)
- / 1024)
- , (msgb == (char *)0) ? ' ' : '*'
- , (int)(dbtob((u_quad_t)qup->dqblk.dqb_bsoftlimit)
- / 1024)
- , (int)(dbtob((u_quad_t)qup->dqblk.dqb_bhardlimit)
- / 1024)
- , (msgb == (char *)0) ? ""
+ printf("%15s%8d%c%7d%8d%8s",
+ nam,
+ (int)(dbtob((u_quad_t)qup->dqblk.dqb_curblocks)
+ / 1024),
+ (msgb == (char *)0) ? ' ' : '*',
+ (int)(dbtob((u_quad_t)qup->dqblk.dqb_bsoftlimit)
+ / 1024),
+ (int)(dbtob((u_quad_t)qup->dqblk.dqb_bhardlimit)
+ / 1024),
+ (msgb == (char *)0) ? ""
: timeprt(qup->dqblk.dqb_btime));
- printf("%8d%c%7d%8d%8s\n"
- , qup->dqblk.dqb_curinodes
- , (msgi == (char *)0) ? ' ' : '*'
- , qup->dqblk.dqb_isoftlimit
- , qup->dqblk.dqb_ihardlimit
- , (msgi == (char *)0) ? ""
+ printf("%8d%c%7d%8d%8s\n",
+ qup->dqblk.dqb_curinodes,
+ (msgi == (char *)0) ? ' ' : '*',
+ qup->dqblk.dqb_isoftlimit,
+ qup->dqblk.dqb_ihardlimit,
+ (msgi == (char *)0) ? ""
: timeprt(qup->dqblk.dqb_itime)
);
continue;
@@ -406,17 +406,16 @@ heading(type, id, name, tag)
printf("Disk quotas for %s %s (%cid %ld): %s\n", qfextension[type],
name, *qfextension[type], id, tag);
if (!qflag && tag[0] == '\0') {
- printf("%15s%8s %7s%8s%8s%8s %7s%8s%8s\n"
- , "Filesystem"
- , "blocks"
- , "quota"
- , "limit"
- , "grace"
- , "files"
- , "quota"
- , "limit"
- , "grace"
- );
+ printf("%15s%8s %7s%8s%8s%8s %7s%8s%8s\n",
+ "Filesystem",
+ "blocks",
+ "quota",
+ "limit",
+ "grace",
+ "files",
+ "quota",
+ "limit",
+ "grace");
}
}