diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 2000-10-18 20:37:43 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 2000-10-18 20:37:43 +0000 |
commit | 96dec0c64f6f3159b9d0afabdad6152308ee68aa (patch) | |
tree | 6c1cca0271c744da164881c67d2c05207e2b614d | |
parent | 2b1b090938b4853731a38139e05ce8a1a0b0a487 (diff) |
sort out printf formats according to types, 64bit arithmetics in ffs_df; millert@ ok
-rw-r--r-- | bin/df/df.c | 13 | ||||
-rw-r--r-- | bin/df/ffs_df.c | 4 |
2 files changed, 8 insertions, 9 deletions
diff --git a/bin/df/df.c b/bin/df/df.c index 818e66d9a87..4fa2e391682 100644 --- a/bin/df/df.c +++ b/bin/df/df.c @@ -1,4 +1,4 @@ -/* $OpenBSD: df.c,v 1.26 2000/03/24 19:07:49 millert Exp $ */ +/* $OpenBSD: df.c,v 1.27 2000/10/18 20:37:42 mickey Exp $ */ /* $NetBSD: df.c,v 1.21.2.1 1995/11/01 00:06:11 jtc Exp $ */ /* @@ -49,7 +49,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)df.c 8.7 (Berkeley) 4/2/94"; #else -static char rcsid[] = "$OpenBSD: df.c,v 1.26 2000/03/24 19:07:49 millert Exp $"; +static char rcsid[] = "$OpenBSD: df.c,v 1.27 2000/10/18 20:37:42 mickey Exp $"; #endif #endif /* not lint */ @@ -367,8 +367,7 @@ prthuman(sfsp, used) void prtstat(sfsp, maxwidth, headerlen, blocksize) struct statfs *sfsp; - int maxwidth, headerlen; - long blocksize; + int maxwidth, headerlen, blocksize; { u_int32_t used, inodes; int32_t availblks; @@ -388,7 +387,7 @@ prtstat(sfsp, maxwidth, headerlen, blocksize) if (iflag) { inodes = sfsp->f_files; used = inodes - sfsp->f_ffree; - (void)printf(" %7ld %7ld %5.0f%% ", used, sfsp->f_ffree, + (void)printf(" %7u %7u %5.0f%% ", used, sfsp->f_ffree, inodes == 0 ? 100.0 : (double)used / (double)inodes * 100.0); } else (void)printf(" "); @@ -446,7 +445,7 @@ posixprint(mntbuf, mntsize, maxwidth) { int i; int blocklen; - long blocksize; + int blocksize; char *blockstr; struct statfs *sfsp; long used, avail; @@ -475,7 +474,7 @@ posixprint(mntbuf, mntsize, maxwidth) percentused = (used * 100 / avail) + ((used % avail) ? 1 : 0); - (void) printf ("%-*.*s %*ld %10ld %11ld %5d%% %s\n", + (void) printf ("%-*.*s %*d %10ld %11d %5d%% %s\n", maxwidth, maxwidth, sfsp->f_mntfromname, strlen(blockstr), fsbtoblk(sfsp->f_blocks, sfsp->f_bsize, blocksize), diff --git a/bin/df/ffs_df.c b/bin/df/ffs_df.c index 43bf3e55b8b..d44fe740e80 100644 --- a/bin/df/ffs_df.c +++ b/bin/df/ffs_df.c @@ -83,8 +83,8 @@ ffs_df(rfd, file, sfsp) sfsp->f_blocks = sblock.fs_dsize; sfsp->f_bfree = sblock.fs_cstotal.cs_nbfree * sblock.fs_frag + sblock.fs_cstotal.cs_nffree; - sfsp->f_bavail = (sblock.fs_dsize * (100 - sblock.fs_minfree) / 100) - - (sblock.fs_dsize - sfsp->f_bfree); + sfsp->f_bavail = ((int64_t)sblock.fs_dsize * (100 - + sblock.fs_minfree) / 100) - (sblock.fs_dsize - sfsp->f_bfree); sfsp->f_files = sblock.fs_ncg * sblock.fs_ipg - ROOTINO; sfsp->f_ffree = sblock.fs_cstotal.cs_nifree; sfsp->f_fsid.val[0] = 0; |