[Midnightbsd-cvs] src [8870] trunk/usr.bin/du: add -g flag for gigabyte

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Mon Sep 26 09:18:01 EDT 2016


Revision: 8870
          http://svnweb.midnightbsd.org/src/?rev=8870
Author:   laffer1
Date:     2016-09-26 09:18:01 -0400 (Mon, 26 Sep 2016)
Log Message:
-----------
add -g flag for gigabyte

Modified Paths:
--------------
    trunk/usr.bin/du/du.1
    trunk/usr.bin/du/du.c

Modified: trunk/usr.bin/du/du.1
===================================================================
--- trunk/usr.bin/du/du.1	2016-09-26 13:17:42 UTC (rev 8869)
+++ trunk/usr.bin/du/du.1	2016-09-26 13:18:01 UTC (rev 8870)
@@ -28,7 +28,7 @@
 .\"	@(#)du.1	8.2 (Berkeley) 4/1/94
 .\" $MidnightBSD$
 .\"
-.Dd December 17, 2011
+.Dd July 18, 2012
 .Dt DU 1
 .Os
 .Sh NAME
@@ -38,7 +38,7 @@
 .Nm
 .Op Fl Aclnx
 .Op Fl H | L | P
-.Op Fl h | k | m
+.Op Fl g | h | k | m
 .Op Fl a | s | d Ar depth
 .Op Fl B Ar blocksize
 .Op Fl I Ar mask
@@ -63,9 +63,9 @@
 .Ar blocksize
 byte blocks.
 This is different from the
-.Fl h, k
+.Fl h, k, m
 and
-.Fl  m
+.Fl  g
 options or setting
 .Ev BLOCKSIZE
 and gives an estimate of how much space the examined file hierarchy would
@@ -95,6 +95,8 @@
 Display an entry for all files and directories
 .Ar depth
 directories deep.
+.It Fl g
+Display block counts in 1073741824-byte (1 GiB) blocks.
 .It Fl h
 .Dq Human-readable
 output.
@@ -101,7 +103,7 @@
 Use unit suffixes: Byte, Kilobyte, Megabyte,
 Gigabyte, Terabyte and Petabyte.
 .It Fl k
-Display block counts in 1024-byte (1-Kbyte) blocks.
+Display block counts in 1024-byte (1 kiB) blocks.
 .It Fl l
 If a file has multiple hard links, count its size multiple times.
 The default behavior of
@@ -112,7 +114,7 @@
 option is specified, the hard link checks are disabled, and these files
 are counted (and displayed) as many times as they are found.
 .It Fl m
-Display block counts in 1048576-byte (1-Mbyte) blocks.
+Display block counts in 1048576-byte (1 MiB) blocks.
 .It Fl n
 Ignore files and directories with user
 .Dq nodump

Modified: trunk/usr.bin/du/du.c
===================================================================
--- trunk/usr.bin/du/du.c	2016-09-26 13:17:42 UTC (rev 8869)
+++ trunk/usr.bin/du/du.c	2016-09-26 13:18:01 UTC (rev 8870)
@@ -110,7 +110,7 @@
 	depth = INT_MAX;
 	SLIST_INIT(&ignores);
 
-	while ((ch = getopt(argc, argv, "AB:HI:LPasd:chklmnrt:x")) != -1)
+	while ((ch = getopt(argc, argv, "AB:HI:LPasd:cghklmnrt:x")) != -1)
 		switch (ch) {
 		case 'A':
 			Aflag = 1;
@@ -157,6 +157,10 @@
 		case 'c':
 			cflag = 1;
 			break;
+		case 'g':
+			hflag = 0;
+			blocksize = 1073741824;
+			break;
 		case 'h':
 			hflag = 1;
 			break;



More information about the Midnightbsd-cvs mailing list