Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Aug 2009 17:57:48 GMT
From:      Craig R <c4@backfire.ca>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   misc/137399: du with gigabyte units
Message-ID:  <200908031757.n73HvmxU098759@www.freebsd.org>
Resent-Message-ID: <200908031800.n73I0CY0007732@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200908031757.n73HvmxU098759>