From 57913dac8bac7389534f248065e86671d84c880a Mon Sep 17 00:00:00 2001 From: des Date: Fri, 1 Mar 2013 09:40:02 +0000 Subject: [PATCH] MFH (r238602): add -g (gigabyte) flag git-svn-id: svn://svn.freebsd.org/base/stable/8@247539 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- usr.bin/du/du.1 | 14 ++++++++------ usr.bin/du/du.c | 6 +++++- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/usr.bin/du/du.1 b/usr.bin/du/du.1 index 310ca4916..d3533008b 100644 --- a/usr.bin/du/du.1 +++ b/usr.bin/du/du.1 @@ -32,7 +32,7 @@ .\" @(#)du.1 8.2 (Berkeley) 4/1/94 .\" $FreeBSD$ .\" -.Dd December 17, 2011 +.Dd July 18, 2012 .Dt DU 1 .Os .Sh NAME @@ -42,7 +42,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 @@ -67,9 +67,9 @@ Calculate block counts in .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 @@ -99,13 +99,15 @@ Display a grand total. 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. 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 @@ -116,7 +118,7 @@ When the 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 diff --git a/usr.bin/du/du.c b/usr.bin/du/du.c index 67b4cb66b..822060e10 100644 --- a/usr.bin/du/du.c +++ b/usr.bin/du/du.c @@ -114,7 +114,7 @@ main(int argc, char *argv[]) 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; @@ -161,6 +161,10 @@ main(int argc, char *argv[]) case 'c': cflag = 1; break; + case 'g': + hflag = 0; + blocksize = 1073741824; + break; case 'h': hflag = 1; break; -- 2.45.0