summaryrefslogtreecommitdiff
path: root/df.c
diff options
context:
space:
mode:
authorEric Andersen1999-10-07 08:30:23 +0000
committerEric Andersen1999-10-07 08:30:23 +0000
commit596e5469d00fa4a74d8a3b1ebfaae20ce8dc3afe (patch)
tree4d48d109e66c5197bb27c8215062aab28d385509 /df.c
parent5c3199e0a519695c367b773e179b5458670f452b (diff)
downloadbusybox-596e5469d00fa4a74d8a3b1ebfaae20ce8dc3afe.zip
busybox-596e5469d00fa4a74d8a3b1ebfaae20ce8dc3afe.tar.gz
more stuff
Diffstat (limited to 'df.c')
-rw-r--r--df.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/df.c b/df.c
index 354b2a7..8cc9381 100644
--- a/df.c
+++ b/df.c
@@ -3,6 +3,7 @@
#include <mntent.h>
#include <sys/stat.h>
#include <sys/vfs.h>
+#include <fstab.h>
const char df_usage[] = "df [filesystem ...]\n"
"\n"
@@ -10,7 +11,7 @@ const char df_usage[] = "df [filesystem ...]\n"
static int
-df(const char * device, const char * mountPoint)
+df(char* device, const char * mountPoint)
{
struct statfs s;
long blocks_used;
@@ -25,6 +26,8 @@ df(const char * device, const char * mountPoint)
blocks_used = s.f_blocks - s.f_bfree;
blocks_percent_used = (long)
(blocks_used * 100.0 / (blocks_used + s.f_bavail) + 0.5);
+ if ( strcmp(device, "/dev/root")==0)
+ device=(getfsfile ("/"))->fs_spec;
printf(
"%-20s %9ld %9ld %9ld %3ld%% %s\n",
@@ -75,7 +78,7 @@ df_main(int argc, char * * argv)
}
while ( (mountEntry = getmntent (mountTable))) {
- int status=df(mountEntry->mnt_fsname ,mountEntry->mnt_dir);
+ int status=df(mountEntry->mnt_fsname, mountEntry->mnt_dir);
if (status)
return status;
}
@@ -129,3 +132,5 @@ findMountPoint(const char* name, const char* table)
endmntent(mountTable);
return mountEntry;
}
+
+