From deskpot@ns2.yellow-pages.spb.ru  Fri May 21 02:03:57 2004
Return-Path: <deskpot@ns2.yellow-pages.spb.ru>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 745D316A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 21 May 2004 02:03:57 -0700 (PDT)
Received: from ns2.yellow-pages.spb.ru (ns2.yellow-pages.spb.ru [195.144.224.135])
	by mx1.FreeBSD.org (Postfix) with ESMTP id D761F43D45
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 21 May 2004 02:03:56 -0700 (PDT)
	(envelope-from deskpot@ns2.yellow-pages.spb.ru)
Received: from deskpot by ns2.yellow-pages.spb.ru with local id 1BR5wX-000IuE-Cp
	for FreeBSD-gnats-submit@freebsd.org; Fri, 21 May 2004 13:03:53 +0400
Message-Id: <E1BR5wX-000IuE-Cp@ns2.yellow-pages.spb.ru>
Date: Fri, 21 May 2004 13:03:53 +0400
From: Vasily Korytov <deskpot@msk.yell.ru>
Reply-To: Vasily Korytov <deskpot@msk.yell.ru>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: du doesn't have a -m argument
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         66976
>Category:       bin
>Synopsis:       du doesn't have a -m argument
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri May 21 02:10:15 PDT 2004
>Closed-Date:    Wed Jun 02 00:10:03 PDT 2004
>Last-Modified:  Wed Jun 02 00:10:03 PDT 2004
>Originator:     Vasily Korytov
>Release:        FreeBSD 4.9-RELEASE-p5 i386
>Organization:
YPI Yellow Pages LTD
>Environment:
System: FreeBSD ns2.yellow-pages.spb.ru 4.9-RELEASE-p5 FreeBSD 4.9-RELEASE-p5 #0: Wed Apr 21 12:04:37 MSD 2004 root@ns2.yellow-pages.spb.ru:/usr/obj/usr/src/sys/NS2 i386

>Description:
	du(1) that comes with FreeBSD does not understand the -m argument
	(BLOCKSIZE=1m). As far as I know, this option is not required by
	POSIX, but it's commonly used in other du implementations -- for
	example, NetBSD and GNU, so this can really confuse users, which
	don't use only FreeBSD systems.

>How-To-Repeat:
	Type `du -m .` and it reports: ``du: illegal option -- m''

>Fix:
	A patch for du.c and du.1 is included.

--- du.patch begins here ---
diff -u /usr/src/usr.bin/du/du.1 ./du.1
--- /usr/src/usr.bin/du/du.1	Tue Feb 25 01:37:41 2003
+++ ./du.1	Thu May 20 13:52:10 2004
@@ -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
@@ -98,6 +98,8 @@
 Display a grand total.
 .It Fl k
 Display block counts in 1024-byte (1-Kbyte) blocks.
+.It Fl m
+Display block counts in 1048576-byte (1-Mbyte) blocks.
 .It Fl x
 File system mount points are not traversed.
 .El
diff -u /usr/src/usr.bin/du/du.c ./du.c
--- /usr/src/usr.bin/du/du.c	Thu Dec 12 19:29:39 2002
+++ ./du.c	Thu May 20 13:50:35 2004
@@ -125,7 +125,7 @@
 	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;
@@ -170,6 +170,10 @@
 				if (!hflag)
 					putenv("BLOCKSIZE=1024");
 				break;
+			case 'm':
+				if (!hflag)
+					putenv("BLOCKSIZE=1048576");
+				break;
 			case 'r':		 /* Compatibility. */
 				break;
 			case 'x':
@@ -391,7 +395,7 @@
 usage()
 {
 	(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);
 }
 
--- du.patch ends here ---


>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: phk 
State-Changed-When: Wed Jun 2 00:09:53 PDT 2004 
State-Changed-Why:  
committed, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=66976 
>Unformatted:
