misc/137399: du with gigabyte units
Craig R
c4 at backfire.ca
Mon Aug 3 18:00:13 UTC 2009
>Number: 137399
>Category: misc
>Synopsis: du with gigabyte units
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: update
>Submitter-Id: current-users
>Arrival-Date: Mon Aug 03 18:00:12 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator: Craig R
>Release: 7.0
>Organization:
Backfire.ca
>Environment:
>Description:
df supports the -g option, which uses gigs for units. This patch blesses du with the same functionality.
>How-To-Repeat:
Run du with -g, watch it complain.
>Fix:
Apply attached patch liberally. Repeat if desired.
Patch attached with submission follows:
--- du.c.old 2009-08-03 13:46:33.000000000 -0400
+++ du.c 2009-08-03 13:51:36.000000000 -0400
@@ -103,7 +103,7 @@
depth = INT_MAX;
SLIST_INIT(&ignores);
- while ((ch = getopt(argc, argv, "HI:LPasd:chkmnrx")) != -1)
+ while ((ch = getopt(argc, argv, "HI:LPasd:cghkmnrx")) != -1)
switch (ch) {
case 'H':
Hflag = 1;
@@ -139,6 +139,10 @@
case 'c':
cflag = 1;
break;
+ case 'g':
+ hflag = 0;
+ setenv("BLOCKSIZE", "1073741824", 1);
+ break;
case 'h':
setenv("BLOCKSIZE", "512", 1);
hflag = 1;
@@ -443,7 +447,7 @@
usage(void)
{
(void)fprintf(stderr,
- "usage: du [-H | -L | -P] [-a | -s | -d depth] [-c] [-h | -k | -m] [-n] [-x] [-I mask] [file ...]\n");
+ "usage: du [-H | -L | -P] [-a | -s | -d depth] [-c] [-g | -h | -k | -m] [-n] [-x] [-I mask] [file ...]\n");
exit(EX_USAGE);
}
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list