summaryrefslogtreecommitdiffstats
path: root/usr.bin/du
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2004-06-02 07:09:34 +0000
committerphk <phk@FreeBSD.org>2004-06-02 07:09:34 +0000
commitd88857d6805f38355b8ad4fb029972a31db175fe (patch)
treef0d6ae37ebbe4dd24639085f66c64fa8c4307fb2 /usr.bin/du
parent9fe08d77b1f2f7b8812f8eaf61aa0b224b419fa6 (diff)
downloadFreeBSD-src-d88857d6805f38355b8ad4fb029972a31db175fe.zip
FreeBSD-src-d88857d6805f38355b8ad4fb029972a31db175fe.tar.gz
Give du(1) a -m option to report in megabytes.
Submitted by: Vasily Korytov <deskpot@msk.yell.ru> PR: 66976
Diffstat (limited to 'usr.bin/du')
-rw-r--r--usr.bin/du/du.111
-rw-r--r--usr.bin/du/du.c8
2 files changed, 9 insertions, 10 deletions
diff --git a/usr.bin/du/du.1 b/usr.bin/du/du.1
index edbe569..e8f36b1 100644
--- a/usr.bin/du/du.1
+++ b/usr.bin/du/du.1
@@ -44,7 +44,7 @@
.Op Fl I Ar mask
.Op Fl a | s | d Ar depth
.Op Fl c
-.Op Fl h | k
+.Op Fl h | k | m
.Op Fl x
.Op Ar
.Sh DESCRIPTION
@@ -55,13 +55,6 @@ and for each directory in the file hierarchy rooted in each directory
argument.
If no file is specified, the block usage of the hierarchy rooted in
the current directory is displayed.
-If the
-.Fl k
-flag is specified, the number of 1024-byte
-blocks used by the file is displayed, otherwise
-.Xr getbsize 3
-is used to determine the preferred block size.
-Partial numbers of blocks are rounded up.
.Pp
The options are as follows:
.Bl -tag -width indent
@@ -98,6 +91,8 @@ directories deep.
Display a grand total.
.It Fl k
Display block counts in 1024-byte (1-Kbyte) blocks.
+.It Fl m
+Display block counts in 104857-byte (1-Mbyte) blocks.
.It Fl x
File system mount points are not traversed.
.El
diff --git a/usr.bin/du/du.c b/usr.bin/du/du.c
index f2010f1..6b85e17 100644
--- a/usr.bin/du/du.c
+++ b/usr.bin/du/du.c
@@ -96,7 +96,7 @@ main(int argc, char *argv[])
depth = INT_MAX;
SLIST_INIT(&ignores);
- while ((ch = getopt(argc, argv, "HI:LPasd:chkrx")) != -1)
+ while ((ch = getopt(argc, argv, "HI:LPasd:chkmrx")) != -1)
switch (ch) {
case 'H':
Hflag = 1;
@@ -140,6 +140,10 @@ main(int argc, char *argv[])
hflag = 0;
putenv("BLOCKSIZE=1024");
break;
+ case 'm':
+ hflag = 0;
+ putenv("BLOCKSIZE=1048576");
+ break;
case 'r': /* Compatibility. */
break;
case 'x':
@@ -430,7 +434,7 @@ static void
usage(void)
{
(void)fprintf(stderr,
- "usage: du [-H | -L | -P] [-a | -s | -d depth] [-c] [-h | -k] [-x] [-I mask] [file ...]\n");
+ "usage: du [-H | -L | -P] [-a | -s | -d depth] [-c] [-h | -k | -m] [-x] [-I mask] [file ...]\n");
exit(EX_USAGE);
}
OpenPOWER on IntegriCloud