diff options
| author | Eric Andersen <andersen@codepoet.org> | 1999-10-07 08:30:23 +0000 |
|---|---|---|
| committer | Eric Andersen <andersen@codepoet.org> | 1999-10-07 08:30:23 +0000 |
| commit | 596e5469d00fa4a74d8a3b1ebfaae20ce8dc3afe (patch) | |
| tree | 4d48d109e66c5197bb27c8215062aab28d385509 /coreutils/df.c | |
| parent | 5c3199e0a519695c367b773e179b5458670f452b (diff) | |
| download | busybox-w32-596e5469d00fa4a74d8a3b1ebfaae20ce8dc3afe.tar.gz busybox-w32-596e5469d00fa4a74d8a3b1ebfaae20ce8dc3afe.tar.bz2 busybox-w32-596e5469d00fa4a74d8a3b1ebfaae20ce8dc3afe.zip | |
more stuff
Diffstat (limited to 'coreutils/df.c')
| -rw-r--r-- | coreutils/df.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/coreutils/df.c b/coreutils/df.c index 354b2a7ca..8cc93814b 100644 --- a/coreutils/df.c +++ b/coreutils/df.c | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | #include <mntent.h> | 3 | #include <mntent.h> |
| 4 | #include <sys/stat.h> | 4 | #include <sys/stat.h> |
| 5 | #include <sys/vfs.h> | 5 | #include <sys/vfs.h> |
| 6 | #include <fstab.h> | ||
| 6 | 7 | ||
| 7 | const char df_usage[] = "df [filesystem ...]\n" | 8 | const char df_usage[] = "df [filesystem ...]\n" |
| 8 | "\n" | 9 | "\n" |
| @@ -10,7 +11,7 @@ const char df_usage[] = "df [filesystem ...]\n" | |||
| 10 | 11 | ||
| 11 | 12 | ||
| 12 | static int | 13 | static int |
| 13 | df(const char * device, const char * mountPoint) | 14 | df(char* device, const char * mountPoint) |
| 14 | { | 15 | { |
| 15 | struct statfs s; | 16 | struct statfs s; |
| 16 | long blocks_used; | 17 | long blocks_used; |
| @@ -25,6 +26,8 @@ df(const char * device, const char * mountPoint) | |||
| 25 | blocks_used = s.f_blocks - s.f_bfree; | 26 | blocks_used = s.f_blocks - s.f_bfree; |
| 26 | blocks_percent_used = (long) | 27 | blocks_percent_used = (long) |
| 27 | (blocks_used * 100.0 / (blocks_used + s.f_bavail) + 0.5); | 28 | (blocks_used * 100.0 / (blocks_used + s.f_bavail) + 0.5); |
| 29 | if ( strcmp(device, "/dev/root")==0) | ||
| 30 | device=(getfsfile ("/"))->fs_spec; | ||
| 28 | 31 | ||
| 29 | printf( | 32 | printf( |
| 30 | "%-20s %9ld %9ld %9ld %3ld%% %s\n", | 33 | "%-20s %9ld %9ld %9ld %3ld%% %s\n", |
| @@ -75,7 +78,7 @@ df_main(int argc, char * * argv) | |||
| 75 | } | 78 | } |
| 76 | 79 | ||
| 77 | while ( (mountEntry = getmntent (mountTable))) { | 80 | while ( (mountEntry = getmntent (mountTable))) { |
| 78 | int status=df(mountEntry->mnt_fsname ,mountEntry->mnt_dir); | 81 | int status=df(mountEntry->mnt_fsname, mountEntry->mnt_dir); |
| 79 | if (status) | 82 | if (status) |
| 80 | return status; | 83 | return status; |
| 81 | } | 84 | } |
| @@ -129,3 +132,5 @@ findMountPoint(const char* name, const char* table) | |||
| 129 | endmntent(mountTable); | 132 | endmntent(mountTable); |
| 130 | return mountEntry; | 133 | return mountEntry; |
| 131 | } | 134 | } |
| 135 | |||
| 136 | |||
