Safer way to print results
This commit is contained in:
parent
32cccc3f68
commit
258c24e143
16
src/df.c
16
src/df.c
|
@ -69,13 +69,19 @@ static int _df_mtab(Prefs * prefs)
|
||||||
static void _df_print(Prefs * prefs, const struct statvfs * f)
|
static void _df_print(Prefs * prefs, const struct statvfs * f)
|
||||||
{
|
{
|
||||||
unsigned long long mod;
|
unsigned long long mod;
|
||||||
|
unsigned long long cnt;
|
||||||
|
unsigned long long used;
|
||||||
|
unsigned long long avail;
|
||||||
|
unsigned int cap;
|
||||||
|
|
||||||
mod = f->f_bsize / ((*prefs & PREFS_k) ? 8192 : 4096);
|
mod = f->f_bsize / ((*prefs & PREFS_k) ? 8192 : 4096);
|
||||||
printf("%-11s %10llu %10llu %10llu %7llu%% %s\n", f->f_mntfromname,
|
cnt = f->f_blocks * mod;
|
||||||
f->f_blocks * mod, (f->f_blocks - f->f_bfree) * mod,
|
used = (f->f_blocks - f->f_bfree) * mod;
|
||||||
f->f_bavail * mod, ((f->f_blocks - f->f_bfree) * 100)
|
avail = f->f_bavail * mod;
|
||||||
/ ((f->f_blocks - f->f_bfree) + f->f_bavail),
|
cap = ((f->f_blocks - f->f_bfree) * 100)
|
||||||
f->f_mntonname);
|
/ ((f->f_blocks - f->f_bfree) + f->f_bavail);
|
||||||
|
printf("%-11s %10llu %10llu %10llu %7u%% %s\n", f->f_mntfromname,
|
||||||
|
cnt, used, avail, cap, f->f_mntonname);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _df_do(Prefs * prefs, char const * file)
|
static int _df_do(Prefs * prefs, char const * file)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user