[Midnightbsd-cvs] src [11549] trunk/usr.bin/du/du.c: sync with freebsd.

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sat Jul 7 17:49:48 EDT 2018


Revision: 11549
          http://svnweb.midnightbsd.org/src/?rev=11549
Author:   laffer1
Date:     2018-07-07 17:49:48 -0400 (Sat, 07 Jul 2018)
Log Message:
-----------
sync with freebsd.

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

Property Changed:
----------------
    trunk/usr.bin/du/du.1

Modified: trunk/usr.bin/du/Makefile
===================================================================
--- trunk/usr.bin/du/Makefile	2018-07-07 21:25:08 UTC (rev 11548)
+++ trunk/usr.bin/du/Makefile	2018-07-07 21:49:48 UTC (rev 11549)
@@ -1,8 +1,15 @@
+# $MidnightBSD$
 #	@(#)Makefile	8.1 (Berkeley) 6/6/93
-# $MidnightBSD$
+# $FreeBSD: stable/10/usr.bin/du/Makefile 321133 2017-07-18 16:49:24Z ngie $
 
+.include <bsd.own.mk>
+
 PROG=	du
 DPADD=	${LIBUTIL}
 LDADD=	-lutil
 
+.if ${MK_TESTS} != "no"
+SUBDIR+=	tests
+.endif
+
 .include <bsd.prog.mk>

Modified: trunk/usr.bin/du/du.1
===================================================================
--- trunk/usr.bin/du/du.1	2018-07-07 21:25:08 UTC (rev 11548)
+++ trunk/usr.bin/du/du.1	2018-07-07 21:49:48 UTC (rev 11549)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,9 +27,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)du.1	8.2 (Berkeley) 4/1/94
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/usr.bin/du/du.1 242551 2012-11-04 09:27:01Z joel $
 .\"
-.Dd July 18, 2012
+.Dd November 4, 2012
 .Dt DU 1
 .Os
 .Sh NAME
@@ -191,6 +192,24 @@
 options are not specified, the block counts will be displayed in 512-byte
 blocks.
 .El
+.Sh EXAMPLES
+Show disk usage for all files in the current directory.
+Output is in human-readable form:
+.Pp
+.Dl # du -ah
+.Pp
+Summarize disk usage in the current directory:
+.Pp
+.Dl # du -hs
+.Pp
+Summarize disk usage for a specific directory:
+.Pp
+.Dl # du -hs /home
+.Pp
+Show name and size of all C files in a specific directory.
+Also display a grand total at the end:
+.Pp
+.Dl # du -ch /usr/src/sys/kern/*.c
 .Sh SEE ALSO
 .Xr df 1 ,
 .Xr chflags 2 ,


Property changes on: trunk/usr.bin/du/du.1
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/usr.bin/du/du.c
===================================================================
--- trunk/usr.bin/du/du.c	2018-07-07 21:25:08 UTC (rev 11548)
+++ trunk/usr.bin/du/du.c	2018-07-07 21:49:48 UTC (rev 11549)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Copyright (c) 1989, 1993, 1994
  *	The Regents of the University of California.  All rights reserved.
@@ -42,12 +43,11 @@
 #endif
 #endif /* not lint */
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/usr.bin/du/du.c 321097 2017-07-17 21:18:44Z ngie $");
 
 #include <sys/param.h>
 #include <sys/queue.h>
 #include <sys/stat.h>
-
 #include <err.h>
 #include <errno.h>
 #include <fnmatch.h>
@@ -61,7 +61,7 @@
 #include <sysexits.h>
 #include <unistd.h>
 
-SLIST_HEAD(ignhead, ignentry) ignores;
+static SLIST_HEAD(ignhead, ignentry) ignores;
 struct ignentry {
 	char			*mask;
 	SLIST_ENTRY(ignentry)	next;
@@ -88,7 +88,6 @@
 	off_t		savednumber, curblocks;
 	off_t		threshold, threshold_sign;
 	int		ftsoptions;
-	int		listall;
 	int		depth;
 	int		Hflag, Lflag, aflag, sflag, dflag, cflag;
 	int		hflag, lflag, ch, notused, rval;
@@ -223,17 +222,10 @@
 	if (!Aflag && (cblocksize % DEV_BSIZE) != 0)
 		cblocksize = howmany(cblocksize, DEV_BSIZE) * DEV_BSIZE;
 
-	listall = 0;
-
-	if (aflag) {
-		if (sflag || dflag)
-			usage();
-		listall = 1;
-	} else if (sflag) {
-		if (dflag)
-			usage();
+	if (aflag + dflag + sflag > 1)
+		usage();
+	if (sflag)
 		depth = 0;
-	}
 
 	if (!*argv) {
 		argv = save;
@@ -314,7 +306,7 @@
 			    howmany(p->fts_statp->st_size, cblocksize) :
 			    howmany(p->fts_statp->st_blocks, cblocksize);
 
-			if (listall || p->fts_level == 0) {
+			if (aflag || p->fts_level == 0) {
 				if (hflag) {
 					prthumanval(curblocks);
 					(void)printf("\t%s\n", p->fts_path);
@@ -501,7 +493,7 @@
 usage(void)
 {
 	(void)fprintf(stderr,
-		"usage: du [-Aclnx] [-H | -L | -P] [-h | -k | -m ] "
+		"usage: du [-Aclnx] [-H | -L | -P] [-g | -h | -k | -m] "
 		"[-a | -s | -d depth] [-B blocksize] [-I mask] "
 		"[-t threshold] [file ...]\n");
 	exit(EX_USAGE);
@@ -525,7 +517,7 @@
 ignoreclean(void)
 {
 	struct ignentry *ign;
-	
+
 	while (!SLIST_EMPTY(&ignores)) {
 		ign = SLIST_FIRST(&ignores);
 		SLIST_REMOVE_HEAD(&ignores, next);



More information about the Midnightbsd-cvs mailing list